note 112574 deleted from function.boolval by googleguy

From: Date: Mon, 01 Jul 2013 08:34:47 +0000
Subject: note 112574 deleted from function.boolval by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-195418@lists.php.net to get a copy of this message
Note Submitter: luigi_cangiano at hotmail dot it ---- // Hack for old php versions to use boolval() if(!function_exists('boolval')) { function boolval($var = null) { $back = false; switch(gettype($var)) { case 'boolean': $back = $var; break; case 'float': case 'double': $var = intval($var); case 'integer': $back = $var !== 0; break; case 'string': switch(strtolower($var)) { case 'y': case 's': case 'true': case 'vero': case '1': $back = true; break; case 'n': case 'false': case 'falso': case '0': $back = false; break; default: $back = (bool)$var; } break; default: $back = (bool)$var; break; } return $back; } }

« previous php.notes (#195418) next »