note 41217 added to function.intval
| From: | paul at SPAMFREEMAN dot santasoft dot com | Date: | Fri, 02 Apr 2004 18:27:12 +0000 |
| Subject: | note 41217 added to function.intval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67535@lists.php.net to get a copy of this message | ||
OOpsie-doopsie, forgot the meat and potatoes..
in that example below,
<?php
$num = pi();
echo (int) ($num * 10); // prints 31, not 30
?>
Note that this does the same thing and returns 31 as desired:
<?php
$num = pi();
echo intval($num * 10); // prints 31, not 30
?>
So intval is a good thing in certain circumstances.
----
Manual Page -- http://www.php.net/manual/en/function.intval.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41217
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41217&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41217&report=yes
Search -- http://master.php.net/manage/user-notes.php