Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16658 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73479 invoked by uid 1010); 14 Jun 2005 11:50:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73464 invoked from network); 14 Jun 2005 11:50:04 -0000 Received: from unknown (HELO php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2005 11:50:04 -0000 X-Host-Fingerprint: 213.115.162.47 mailgate1.mysql.com Linux 2.5 (sometimes 2.4) (4) Received: from ([213.115.162.47:45665] helo=mailgate.mysql.com) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 84/7A-20931-B64CEA24 for ; Tue, 14 Jun 2005 07:50:03 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.mysql.com (8.13.2/8.13.1) with ESMTP id j5EBnxD2011073; Tue, 14 Jun 2005 13:49:59 +0200 Received: from mail.mysql.com ([10.222.1.99]) by localhost (mailgate.mysql.com [10.222.1.98]) (amavisd-new, port 10026) with LMTP id 08413-02; Tue, 14 Jun 2005 13:49:59 +0200 (CEST) Received: from [127.0.0.1] (mail.mysql.com [10.100.1.21]) by mail.mysql.com (8.13.3/8.13.3) with ESMTP id j5EBnq7X028415; Tue, 14 Jun 2005 13:49:52 +0200 Message-ID: <42AEC486.3080408@php.net> Date: Tue, 14 Jun 2005 13:50:30 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b) Gecko/20050217 MIME-Version: 1.0 To: "M. Sokolewicz" CC: internals@lists.php.net References: <5.1.0.14.2.20050603203711.028e9140@localhost> <200506051859.53976.magnus@php.net> <6E.27.21296.C90E7A24@pb1.pair.com> <38.CE.21296.BFD78A24@pb1.pair.com> <43.34.20931.17BEDA24@pb1.pair.com> <1118701987.27553.6.camel@blobule.suds> <53F92510-14F5-4E4E-939F-8FC382A7B925@botimer.net> <87728790.20050613214458@ionzoft.com> <52.4A.20931.FBB6EA24@pb1.pair.com> <1118730688.27553.19.camel@blobule.suds> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailgate.mysql.com Subject: Re: [PHP-DEV] PHP 5.1 From: hartmut@php.net (Hartmut Holzgraefe) M. Sokolewicz wrote: >> $x = (isset($ANY_var) ? $ANY_var : 'Default Value'); >> by >> $x = ifsetor($ANY_var, 'Default Value'); >> > I must say I fully agree; I don't see any use in putting extra functions > in the PHP namespace just because people don't want to type a couple of > extra characters. it is not "a few extra characters", its "needless duplication of characters", and the number of characters multiplies with the number of uses of the construct please keep in mind that $ANY_var can be a variable name of any length or an element of a multidimensional array. this can leed to unreadably long statements, hard to track down copy errors and is a maintainance nichtmare as you always have to change things in two places at the same time How quick can you spot the error in the following assignment? And if you didn't know the context: how long would it take you to find out what it does? $x = (isset($config['general']['foo']['bar']['somelist']) ? $config['general']['foo']['bar']['sonelist'] : "default"); On the other hand the meaning of $x = ifsetor($config['general']['foo']['bar']['somelist'], "default"); is pretty clear, only about half as long and way less error prone. I don't really like the name 'ifsetor' but i *love* the concept and given that there is no proper way to implement this function in user space i'm perfectly in favor of its addition.