note 40514 deleted from function.intval by vrana
| From: | vrana@php.net | Date: | Tue, 15 Mar 2005 13:54:38 +0000 |
| Subject: | note 40514 deleted from function.intval by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86473@lists.php.net to get a copy of this message | ||
Note Submitter: lordfarquaad at notredomaine dot net
----
What about :
<?php
$num = (int) $num;
?>
It seems to me the easier way to convert a string to an integer, if you don't want to change
the base. I think it's better than + 0 in long instructions. For exemple this will produce the
awaited result:
<?php
$num = pi();
echo (int) $num * 10; // prints 30, not 31
?>
with + 0 you would use brackets...