note 102541 deleted from function.is-int by aharvey
| From: | aharvey@php.net | Date: | Thu, 21 Mar 2013 18:38:57 +0000 |
| Subject: | note 102541 deleted from function.is-int by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194165@lists.php.net to get a copy of this message | ||
Note Submitter: derek at storkey dot co dot uk
----
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.