ceil


php128 apg

RETURNS the next HIGHEST 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 highest 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 ceil 
( 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 
ceilval($val01, $loc01)
{
    
    
    echo 
'Rounded value = ' . ceil($val01) . 
                     
'<br>From given value = ' . $val01 . '<br><br>';
}

ceilval(234, 0);

ceilval(-234, 0);

ceilval(4.9956, 0);

ceilval(-4.9956, 0);

ceilval(1.99E+29, 0);

ceilval(1.99E-29, 0);

ceilval(M_PI, 0);

?>