note 98312 deleted from function.gettype by cmb

From: Date: Mon, 02 Nov 2020 21:58:30 +0000
Subject: note 98312 deleted from function.gettype by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215777@lists.php.net to get a copy of this message
Note Submitter: SoN9ne at gmail dot com ---- This is my work around for the gettype warning. Hope some find it useful. <?php /** * Returns the type of the passed var * - PHP warns against using gettype(), this is my workaround * * @param mixed $var * @return string */ function myGetType($var) { if (is_array($var)) return "array"; if (is_bool($var)) return "boolean"; if (is_callable($var)) return "function reference"; if (is_float($var)) return "float"; if (is_int($var)) return "integer"; if (is_null($var)) return "NULL"; if (is_numeric($var)) return "numeric"; if (is_object($var)) return "object"; if (is_resource($var)) return "resource"; if (is_string($var)) return "string"; return "unknown type"; } ?> [EDITOR thiago NOTE: Code has been updated by PPKu-N0-SPAM-schy at mediasoft-berlin dot de]

« previous php.notes (#215777) next »