note 78381 deleted from function.gettype by felipe
| From: | felipe@php.net | Date: | Sun, 16 Dec 2007 12:56:28 +0000 |
| Subject: | note 78381 deleted from function.gettype by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133707@lists.php.net to get a copy of this message | ||
Note Submitter: support at wifilinx dot com
Reason: 1
----
<?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
?>