note 25635 added to function.gettype

From: Date: Tue, 01 Oct 2002 08:33:46 +0000
Subject: note 25635 added to function.gettype
Groups: php.notes 
Request: Send a blank email to php-notes+get-37455@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.gettype.php http://master.php.net/manage/user-notes.php?action=edit+25635 http://master.php.net/manage/user-notes.php?action=delete+25635 http://master.php.net/manage/user-notes.php?action=reject+25635

« previous php.notes (#37455) next »