Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32216 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15556 invoked by uid 1010); 10 Sep 2007 22:27:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15541 invoked from network); 10 Sep 2007 22:27:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2007 22:27:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=andrew@ashearer.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andrew@ashearer.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ashearer.com from 68.230.240.47 cause and error) X-PHP-List-Original-Sender: andrew@ashearer.com X-Host-Fingerprint: 68.230.240.47 eastrmmtao105.cox.net Solaris 10 (beta) Received: from [68.230.240.47] ([68.230.240.47:39978] helo=eastrmmtao105.cox.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/81-06300-6E4C5E64 for ; Mon, 10 Sep 2007 18:27:51 -0400 Received: from eastrmimpo02.cox.net ([68.1.16.120]) by eastrmmtao105.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20070910222748.JGGB28290.eastrmmtao105.cox.net@eastrmimpo02.cox.net> for ; Mon, 10 Sep 2007 18:27:48 -0400 Received: from [192.168.0.2] ([72.195.132.65]) by eastrmimpo02.cox.net with bizsmtp id mmTn1X00d1Qoypk0000000; Mon, 10 Sep 2007 18:27:48 -0400 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> References: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> Content-Type: multipart/mixed; boundary=Apple-Mail-19-702670333 Message-ID: <3A131B98-555D-482C-A513-1E2C8E0F8807@ashearer.com> Date: Mon, 10 Sep 2007 18:27:47 -0400 To: internals@lists.php.net X-Mailer: Apple Mail (2.752.3) Subject: Re: [PHP-DEV] [PATCH] array_get() From: andrew@ashearer.com (Andrew Shearer) --Apple-Mail-19-702670333 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Let me try that again with the files attached. I'll leave out the full original proposal this time. --Apple-Mail-19-702670333 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 10, 2007, at 6:12 PM, Andrew Shearer wrote: > Here's a patch against HEAD that implements the array_get function > previously suggested on this list. I also attached a test suite, > which should go in ext/standard/tests/array/array_get.phpt. > Feedback is welcome. > > Independently, someone else had posted the same idea as a feature > request for PHP 5, and if there's interest I can backport it. > > 40792 Open Wish: Function array_get(&$mixed, $key, > $defaultvalue) > > /* Prototype: > * mixed array_get ( array $search, mixed $key, mixed $default ); > * Description: > * Returns the value corresponding to the given key if the key exists > * in the array. $key can be any value possible for an array index. > * If the key does not exist, the function returns $default, or FALSE > * if $default is not specified. Also works on objects. > * Similar semantics to array_key_exists. > */ > > Here is the original proposal: ... -- Andrew Shearer http://ashearer.com/ --Apple-Mail-19-702670333--