Category:

Round off decimal to nearest highest value

If you wan’t to round off decimal value to nearest heights value you can use bellow code <?php if( !function_exists(‘ceiling’) ) { function ceiling($number, $significance = 1) { $value = ( is_numeric($number) && is_numeric($significance) ) ? (ceil($number/$significance)*$significance) : false; if(!isFloatWith2Decimals($value)){ return $value.’0′; }else{ return $value; } } } function isFloatWith2Decimals($number) { return (bool) preg_match(‘/^(?:[1-9]{1}\d*|0)\.\d{2}$/’, $number); […]

Continue Reading
Posted On :