note 94046 added to function.intval
| From: | vee at osu1 dot php dot net | Date: | Tue, 13 Oct 2009 18:02:11 +0000 |
| Subject: | note 94046 added to function.intval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161699@lists.php.net to get a copy of this message | ||
$intnum = "1.2";
echo intval($intnum);//result always down as 1
.....
$intnum = "1.2";
if(($intnum -(int)$intnum )!=0)$intnum ++;
echo intval($intnum);//result always up as 2
.....
$intnum = "1.2";
if(($intnum -(int)$intnum )>=0.5)$intnum ++;
echo intval($intnum);//result up to 2 if morethan 1.5 else down to 1 if lessthan 1.4
thanks to tteen.net/view.php?time=20090628141741
----
Server IP: 69.147.83.197
Probable Submitter: 124.120.29.11
----
Manual Page -- http://www.php.net/manual/en/function.intval.php
Edit -- https://master.php.net/note/edit/94046
Del: integrated -- https://master.php.net/note/delete/94046/integrated
Del: useless -- https://master.php.net/note/delete/94046/useless
Del: bad code -- https://master.php.net/note/delete/94046/bad+code
Del: spam -- https://master.php.net/note/delete/94046/spam
Del: non-english -- https://master.php.net/note/delete/94046/non-english
Del: in docs -- https://master.php.net/note/delete/94046/in+docs
Del: other reasons-- https://master.php.net/note/delete/94046
Reject -- https://master.php.net/note/reject/94046
Search -- https://master.php.net/manage/user-notes.php