note 111729 added to function.is-int
| From: | info at drupalfever dot com | Date: | Thu, 21 Mar 2013 17:10:18 +0000 |
| Subject: | note 111729 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194159@lists.php.net to get a copy of this message | ||
The function that "Derek from storkey.com.uk" suggested was returning TRUE for strings as
well!!
Nothing else was working for me so I decided to create another function.
<?php
function string_is_int($val) {
if ($val == '0') {
return TRUE;
}
$num = (int)$val;
if ($num == 0) {
return FALSE;
}
return TRUE;
}
?>
This one seems to be working fine for me.
----
Server IP: 69.147.83.199
Probable Submitter: 173.9.137.22
----
Manual Page -- http://php.net/manual/en/function.is-int.php
Edit -- https://master.php.net/note/edit/111729
Del: integrated -- https://master.php.net/note/delete/111729/integrated
Del: useless -- https://master.php.net/note/delete/111729/useless
Del: bad code -- https://master.php.net/note/delete/111729/bad+code
Del: spam -- https://master.php.net/note/delete/111729/spam
Del: non-english -- https://master.php.net/note/delete/111729/non-english
Del: in docs -- https://master.php.net/note/delete/111729/in+docs
Del: other reasons-- https://master.php.net/note/delete/111729
Reject -- https://master.php.net/note/reject/111729
Search -- https://master.php.net/manage/user-notes.php