Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9189 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95597 invoked by uid 1010); 15 Apr 2004 15:47:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95543 invoked from network); 15 Apr 2004 15:47:08 -0000 Received: from unknown (HELO theta.altoona-pa.com) (209.161.72.28) by pb1.pair.com with SMTP; 15 Apr 2004 15:47:08 -0000 Received: from ionzoft-jeg.ionzoft.com (dpvc-207-68-114-163.alt.east.verizon.net [207.68.114.163]) by theta.altoona-pa.com (Postfix) with ESMTP id 6148A13F0F for ; Thu, 15 Apr 2004 11:47:07 -0400 (EDT) Message-ID: <5.1.0.14.0.20040415113948.025ef158@mail.ionzoft.com> X-Sender: izftjason@mail.ionzoft.com X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 15 Apr 2004 11:47:13 -0400 To: internals@lists.php.net In-Reply-To: <20040415153725.56389.qmail@pb1.pair.com> References: <5.1.0.14.0.20040415111759.00b77c18@mail.ionzoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Re: Construct Request From: jason@ionzoft.com (Jason Garber) 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