note 25635 deleted from function.gettype by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 10:06:25 +0000 |
| Subject: | note 25635 deleted from function.gettype by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48486@lists.php.net to get a copy of this message | ||
Note Submitter: james@uvmedia.com
----
just to make sure - with reference to clks comments ->
$var = 1234567890;
if(gettype($var)==("integer" || "double")) {
echo "number";
} else {
echo "no number";
}
Naturally CLK means:
if((gettype($var)=="integer" || (gettype($var)=="double")) {
of
if (( "integer" == $type = gettype( $var ) ) || $type == "double" )) {
to save processing.
The CLK shortcut actually creates boolean true out of the 'or' between two non-empty
strings, and which matches true when compared ( "==" ) to any gettype return ( gettype
always returns a string result that will convert to boolean true regardless of the contents of the
parameter.)
Correct logic, incorrect syntax. I only mention this because the syntax of the statement looks
incredibly useful.