note 116890 added to function.is-int
| From: | felix dot b at outlook dot com | Date: | Mon, 16 Mar 2015 14:13:28 +0000 |
| Subject: | note 116890 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201960@lists.php.net to get a copy of this message | ||
((int)$foo === $foo) does exactly the same as is_int($foo), but is faster performancewise, because
PHP has quite an overhead on function calls.
As you can see the expression only returns true if the type (and value) of $foo is the same as
int-casted $foo, which is only the case when foo is an int.
This applies to all the other is* functions aswell.
----
Server IP: 72.52.91.14
Probable Submitter: 91.58.229.34
----
Manual Page -- http://php.net/manual/en/function.is-int.php
Edit -- https://master.php.net/note/edit/116890
Del: integrated -- https://master.php.net/note/delete/116890/integrated
Del: useless -- https://master.php.net/note/delete/116890/useless
Del: bad code -- https://master.php.net/note/delete/116890/bad+code
Del: spam -- https://master.php.net/note/delete/116890/spam
Del: non-english -- https://master.php.net/note/delete/116890/non-english
Del: in docs -- https://master.php.net/note/delete/116890/in+docs
Del: other reasons-- https://master.php.net/note/delete/116890
Reject -- https://master.php.net/note/reject/116890
Search -- https://master.php.net/manage/user-notes.php