Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32218 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24907 invoked by uid 1010); 10 Sep 2007 23:04:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 24892 invoked from network); 10 Sep 2007 23:04:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2007 23:04:48 -0000 Authentication-Results: pb1.pair.com header.from=andrew@ashearer.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andrew@ashearer.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ashearer.com from 208.97.132.177 cause and error) X-PHP-List-Original-Sender: andrew@ashearer.com X-Host-Fingerprint: 208.97.132.177 sd-green-bigip-177.dreamhost.com Linux 2.4/2.6 Received: from [208.97.132.177] ([208.97.132.177:53697] helo=randymail-a7.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/A2-06300-F8DC5E64 for ; Mon, 10 Sep 2007 19:04:47 -0400 Received: from [128.148.96.53] (unknown [128.148.96.53]) by randymail-a7.g.dreamhost.com (Postfix) with ESMTP id 326E9B73F9 for ; Mon, 10 Sep 2007 16:04:18 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <3A131B98-555D-482C-A513-1E2C8E0F8807@ashearer.com> References: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> <3A131B98-555D-482C-A513-1E2C8E0F8807@ashearer.com> Content-Type: multipart/alternative; boundary=Apple-Mail-22-704886065 Message-ID: <7CFEE1E0-F53B-4B46-AD2E-24E816FC3FFE@ashearer.com> Date: Mon, 10 Sep 2007 19:04:43 -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-22-704886065 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I had forgotten that attachments aren't allowed. Here are links to the patch and test suite. This ought to work. Sorry for the multiple posts, everyone. http://ashearer.com/software/array_get/2007-09-10-php6/array_get.diff http://ashearer.com/software/array_get/2007-09-10-php6/array_get.phpt On Sep 10, 2007, at 6:27 PM, Andrew Shearer wrote: > Let me try that again with the files attached. I'll leave out the > full original proposal this time. > > > 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-22-704886065--