> echo setor($required_variable, die('error...'); > or > echo setor($error, ''); > or > echo setor($sMessage, $sDefaultMessage). > or > $z = setor($_GET['z'], 'Default'); > $z = setor($_GET['z'], 'Default');
Whats wrong with defining a user-level function?
function setor_array(&$array, $key, $default = 0) { return isset($array[$key']) ? $array[$key] : $default; }
$nCustID = (int) setor_array($_GET, 'nCustID', 0);
My issue with defining a user level function is:
a. the actual variable in question could not be passed b. it incurs the overhead of calling a user-level function
I do admit that this may be a plausible solution for the majority of my examples in initializing the incoming script variables, but does not address the general problem of developing with E_NOTICE turned on - for instance, accessing globals or deep arrays that may or may not exist.
It is one of the great features of PHP - accessing an undefined variable, but one that is completely removed when E_NOTICE is turned on.
What is the overhead of calling a simple UDF in php?
~Jason Garber
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php