note 22129 deleted from function.isset by sniper

From: Date: Mon, 06 Oct 2003 02:57:22 +0000
Subject: note 22129 deleted from function.isset by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57865@lists.php.net to get a copy of this message
Note Submitter: nospam@classaxe.com ---- Note that packman@belgacom.net's code posted on 07/05/2001 doesn't quite work in the form shown: With error reporting switched on you will see: Parse error: parse error, expecting T_VARIABLE' or '$'' To get round this, put the result from func_get_arg() into a variable and use it instead, thus: function isset_m() { for ($i = 0; $i < func_num_args(); $i++) { $test = func_get_arg($i); if (!isset($test)) return false; } return true; } To supress a warning when you call it with unset variables, call it like this: $a = ""; $b = 0; // $c = 123 if(@isset_m($a,$b,$c)) ... (do something) This way to can still leave error checking on. It's a good idea to leave warnings on during development: error_reporting(E_ALL); (Martin Francis)

« previous php.notes (#57865) next »