note 99835 added to function.floor
| From: | thesun at osu1 dot php dot net | Date: | Thu, 09 Sep 2010 15:36:04 +0000 |
| Subject: | note 99835 added to function.floor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172424@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 61.195.146.164
Probable Submitter: 210.249.17.80
----
Manual Page -- http://www.php.net/manual/en/function.floor.php
Edit -- https://master.php.net/note/edit/99835
Del: integrated -- https://master.php.net/note/delete/99835/integrated
Del: useless -- https://master.php.net/note/delete/99835/useless
Del: bad code -- https://master.php.net/note/delete/99835/bad+code
Del: spam -- https://master.php.net/note/delete/99835/spam
Del: non-english -- https://master.php.net/note/delete/99835/non-english
Del: in docs -- https://master.php.net/note/delete/99835/in+docs
Del: other reasons-- https://master.php.net/note/delete/99835
Reject -- https://master.php.net/note/reject/99835
Search -- https://master.php.net/manage/user-notes.php