note 102541 added to function.is-int

From: Date: Sun, 20 Feb 2011 13:56:48 +0000
Subject: note 102541 added to function.is-int
Groups: php.notes 
Request: Send a blank email to php-notes+get-177156@lists.php.net to get a copy of this message
I noticed that is_int(sqrt(16)) is false, and I wanted the sqrt to really return an int if it was an int. So I wrote <?php function is_really_int(&$val) { $num = (int)$val; if ($val==$num) { $val=$num; return true; } return false; } ?> You'll may criticise the side effects but I don't think they hurt. ---- Server IP: 69.147.83.197 Probable Submitter: 84.92.56.221 ---- Manual Page -- http://www.php.net/manual/en/function.is-int.php Edit -- https://master.php.net/note/edit/102541 Del: integrated -- https://master.php.net/note/delete/102541/integrated Del: useless -- https://master.php.net/note/delete/102541/useless Del: bad code -- https://master.php.net/note/delete/102541/bad+code Del: spam -- https://master.php.net/note/delete/102541/spam Del: non-english -- https://master.php.net/note/delete/102541/non-english Del: in docs -- https://master.php.net/note/delete/102541/in+docs Del: other reasons-- https://master.php.net/note/delete/102541 Reject -- https://master.php.net/note/reject/102541 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177156) next »