note 22129 added to function.isset

From: Date: Fri, 07 Jun 2002 15:28:55 +0000
Subject: note 22129 added to function.isset
Groups: php.notes 
Request: Send a blank email to php-notes+get-31567@lists.php.net to get a copy of this message
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) -- http://www.php.net/manual/en/function.isset.php http://master.php.net/manage/user-notes.php?action=edit+22129 http://master.php.net/manage/user-notes.php?action=delete+22129 http://master.php.net/manage/user-notes.php?action=reject+22129

« previous php.notes (#31567) next »