note 40514 added to function.intval

From: Date: Sat, 06 Mar 2004 00:28:58 +0000
Subject: note 40514 added to function.intval
Groups: php.notes 
Request: Send a blank email to php-notes+get-66331@lists.php.net to get a copy of this message
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... ---- Manual Page -- http://www.php.net/manual/en/function.intval.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40514 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40514&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40514&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66331) next »