Я приведу здесь альтернативный пример:
function customRound($number)
{
// Extract integer part out of the number.
$int_part = (int)$number;
// Extract decimal part from the number.
$dec_part = (float)($number - $int_part);
// Make the custom round on the decimal part.
$dec_rounded = $dec_part >= 0.75 ? 1.0 : ($dec_part >= 0.26 ? 0.5 : 0.0);
return $int_part + $dec_rounded;
}