note 78382 deleted from function.gettype by nlopess
| From: | nlopess@php.net | Date: | Tue, 09 Oct 2007 21:25:57 +0000 |
| Subject: | note 78382 deleted from function.gettype by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-131257@lists.php.net to get a copy of this message | ||
Note Submitter: support at wifilinx dot com
----
<?php
/*This is a javascript like typeof function that takes the place of is_...*/
function typeof($x){$type = is_ binary($x)?'binary':is_ bool($x)?'bool':is_
buffer($x)?'buffer':is_ callable($x)?'callable':is_
double($x)?'double':is_ float($x)?'float':is_ int($x)?'int':is_
integer($x)?'integer':is_ long($x)?'long':is_ null($x)?'null':is_
numeric($x)?'numeric':is_ object($x)?'object':is_ real($x)?'real':is_
resource($x)?'resource':is_ scalar ($x)?'scalar':is_ string
($x)?'string':is_ unicode($x)?'unicode':false; return $type;}
//i.e
$something = array();
echo typof($something); //returns array
?>
written by Fortune Vieyra, WifiLinx Inc.