note 102541 added to function.is-int
[email protected] Sun, 20 Feb 2011 05:56:48 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
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