Re: Re: Construct Request

From: Date: Thu, 15 Apr 2004 15:47:13 +0000
Subject: Re: Re: Construct Request
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-9189@lists.php.net to get a copy of this message
At 4/15/2004 11:28 AM -0400, Justin Hannus wrote:
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

« previous php.internals (#9189) next »