Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9234 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40572 invoked by uid 1010); 15 Apr 2004 21:27:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40147 invoked from network); 15 Apr 2004 21:27:34 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 15 Apr 2004 21:27:34 -0000 Received: from [192.168.1.105] (p508EAB8A.dip.t-dialin.net [80.142.171.138]) by shiva.mind.de (Postfix) with ESMTP id 3252297B59; Thu, 15 Apr 2004 23:27:33 +0200 (CEST) Date: Thu, 15 Apr 2004 23:27:57 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <186785721187.20040415232757@marcus-boerger.de> To: Justin Hannus Cc: internals@lists.php.net In-Reply-To: <20040415153725.56389.qmail@pb1.pair.com> References: <5.1.0.14.0.20040415111759.00b77c18@mail.ionzoft.com> <20040415153725.56389.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Construct Request From: helly@php.net (Marcus Boerger) Hello Justin, Thursday, April 15, 2004, 5:28:29 PM, you 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); Such a user function would be todays best practice since neither a userfunction setor($val, $else) nor an internal implementation of such a function would work. Here Derick's argument comes into place that we cannot simply change the way variables and array offsets are accessed. The above setor_array() doesn't have that problem though. -- Best regards, Marcus mailto:helly@php.net