Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33417 invoked by uid 1010); 10 Sep 2007 23:35:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33402 invoked from network); 10 Sep 2007 23:35:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2007 23:35:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=info@adaniels.nl; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=info@adaniels.nl; sender-id=unknown Received-SPF: error (pb1.pair.com: domain adaniels.nl from 82.94.236.173 cause and error) X-PHP-List-Original-Sender: info@adaniels.nl X-Host-Fingerprint: 82.94.236.173 loco.helderhosting.nl Linux 2.5 (sometimes 2.4) (4) Received: from [82.94.236.173] ([82.94.236.173:38592] helo=loco.helderhosting.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/01-28088-4A4D5E64 for ; Mon, 10 Sep 2007 19:35:01 -0400 Received: from [192.168.1.101] (pool-71-183-187-12.nycmny.east.verizon.net [71.183.187.12]) by loco (Postfix) with ESMTP id 6789ECB95EF; Tue, 11 Sep 2007 01:34:58 +0200 (CEST) Message-ID: <46E5D4D4.6040304@adaniels.nl> Date: Mon, 10 Sep 2007 19:35:48 -0400 User-Agent: Thunderbird 1.5.0.13 (X11/20070824) MIME-Version: 1.0 To: Andrew Shearer Cc: 'PHP Internals' References: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> <3A131B98-555D-482C-A513-1E2C8E0F8807@ashearer.com> <7CFEE1E0-F53B-4B46-AD2E-24E816FC3FFE@ashearer.com> In-Reply-To: <7CFEE1E0-F53B-4B46-AD2E-24E816FC3FFE@ashearer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] array_get() From: info@adaniels.nl (Arnold Daniels) Hi, Please also add the patch provided by John Bafford last Januari. Arnold Andrew Shearer wrote: > 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/ > >