PHP 8.5.0 Alpha 4 available for testing

Voting

: four minus two?
(Example: nine)

The Note You're Voting On

Scott Weaver / scottmweaver * gmail
16 years ago
I needed this and couldn't find it so I thought someone else wouldn't have to look through a bunch of Google results-

<?php

// duplicates m$ excel's ceiling function
if( !function_exists('ceiling') )
{
function
ceiling($number, $significance = 1)
{
return (
is_numeric($number) && is_numeric($significance) ) ? (ceil($number/$significance)*$significance) : false;
}
}

echo
ceiling(0, 1000); // 0
echo ceiling(1, 1); // 1000
echo ceiling(1001, 1000); // 2000
echo ceiling(1.27, 0.05); // 1.30

?>

<< Back to user notes page

To Top