Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26470 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5140 invoked by uid 1010); 10 Nov 2006 15:25:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5125 invoked from network); 10 Nov 2006 15:25:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2006 15:25:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-php-dev@m.gmane.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=news@sea.gmane.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain m.gmane.org designates 80.91.229.2 as permitted sender) X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from [80.91.229.2] ([80.91.229.2:45876] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/0A-37447-8D994554 for ; Fri, 10 Nov 2006 10:25:16 -0500 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1GiYFa-0003zS-4h for internals@lists.php.net; Fri, 10 Nov 2006 16:25:02 +0100 Received: from bi01p1.nc.us.ibm.com ([129.33.49.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Nov 2006 16:25:02 +0100 Received: from pmuellr by bi01p1.nc.us.ibm.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Nov 2006 16:25:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Fri, 10 Nov 2006 10:22:35 -0500 Lines: 25 Message-ID: References: <45547DF7.8080805@adaniels.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: bi01p1.nc.us.ibm.com User-Agent: Thunderbird 1.5.0.8 (Macintosh/20061025) In-Reply-To: <45547DF7.8080805@adaniels.nl> Sender: news Subject: Re: [PHP-DEV] Yet another feature request From: pmuellr@yahoo.com (Patrick Mueller) Arnold Daniels wrote: > I see this is the time to do language feature request. So let me add > another. I very often use something like: > /$a = isset($x['abc']) ? //$x['abc'] : null; > /This is to prevent an E_NOTICE from being thrown. It seems to me like adding a function: mixed array_get(mixed key, array search [, mixed default_value]) The implementation being: // constraint checking here if (array_key_exists($key,$search) return $search[$key]; return $default_value; would be the way to go. A functional way to do array access (I don't see another way to do this, actually), and also allow a default value if the specified key doesn't exit. Very similiar to the getProperty() method in Java's Properties class. -- Patrick_Mueller@us.ibm.com IBM PHP Community Architect, IBM Research Triangle Park