note 99835 deleted from function.floor by danbrown

From: Date: Thu, 09 Sep 2010 15:45:11 +0000
Subject: note 99835 deleted from function.floor by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172427@lists.php.net to get a copy of this message
Note Submitter: the sun ---- floated floor function can write two type. which one is better? ----+----+----+----+----+---- <?php function floor_f1( $num, $exp ){ return floor( $num * pow( 10, $exp ) / pow( 10, $exp ); } ?> may this work, but some case this function is not work. ----+----+----+----+----+---- <?php functoin floor_f2( $num, $exp ){ if( is_numeric($num) ){ if( is_set( ! $exp ) ){ $exp = 0; } if( is_int( $exp ) ){ $answer = floor( $num * pow( 10, $exp ) / pow( 10, $exp ); }else{ unset( $answer ); } unset( $num ); unset( $exp ); } return $answer; } ?> may almost work. when argument is bad return null.

« previous php.notes (#172427) next »