Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32227 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69486 invoked by uid 1010); 11 Sep 2007 02:31:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69471 invoked from network); 11 Sep 2007 02:31:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2007 02:31:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=tony@daylessday.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tony@daylessday.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain daylessday.org designates 89.208.40.236 as permitted sender) X-PHP-List-Original-Sender: tony@daylessday.org X-Host-Fingerprint: 89.208.40.236 mail.daylessday.org Linux 2.6 Received: from [89.208.40.236] ([89.208.40.236:45092] helo=daylessday.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/66-28088-7EDF5E64 for ; Mon, 10 Sep 2007 22:31:04 -0400 Received: from [192.168.1.36] (ppp91-76-69-176.pppoe.mtu-net.ru [91.76.69.176]) by daylessday.org (Postfix) with ESMTP id 939A26400C5; Tue, 11 Sep 2007 06:31:00 +0400 (MSD) Message-ID: <46E5FDE9.1080909@daylessday.org> Date: Tue, 11 Sep 2007 06:31:05 +0400 User-Agent: Thunderbird 2.0.0.6 (X11/20070801) MIME-Version: 1.0 To: Andrew Shearer CC: internals@lists.php.net References: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> In-Reply-To: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] array_get() From: tony@daylessday.org (Antony Dovgal) On 11.09.2007 02:12, 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. > */ Can you explain, what's the difference between your implementation and this? -- Wbr, Antony Dovgal