floor


php128 apg

RETURNS the next LOWEST integer value by rounding up value if necessary.

Compatible with LOCALE only, up to PHP 7.4.XX.





This function returns the $num rounded up to the next lowest INTEGER.

The returned value of this function is still a FLOAT as the value range of FLOAT is usually bigger than that of INTEGER.



<?php

float floor 
( float $num )


where,

$num = The numeric value to round

?>
 

$num


The number to process.

As off PHP 8.0.0 no longer accepts internal objects which support numeric conversion.



  1 EXERCISE   

<?php

setlocale
(LC_ALL, 'pt-br', 'pt_BR');

function 
floorval($val01, $loc01)
{
    
    
    echo 
'Rounded value = ' . floor($val01) . 
                     
'<br>From given value = ' . $val01 . '<br><br>';
}

floorval(234, 0);

floorval(-234, 0);

floorval(4.9956, 0);

floorval(-4.9956, 0);

floorval(1.99E+29, 0);

floorval(1.99E-29, 0);

floorval(M_PI, 0);

?>