Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27298 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37906 invoked by uid 1010); 6 Jan 2007 12:14:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37891 invoked from network); 6 Jan 2007 12:14:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2007 12:14:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=antony@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=antony@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: antony@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:45538] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/B1-01582-6A29F954 for ; Sat, 06 Jan 2007 07:14:31 -0500 Received: (qmail 27456 invoked from network); 6 Jan 2007 12:12:51 -0000 Received: from internal.zend.office (HELO ?IPv6:::1?) (10.1.1.1) by internal.zend.office with SMTP; 6 Jan 2007 12:12:51 -0000 Message-ID: <459F92A3.7040708@zend.com> Date: Sat, 06 Jan 2007 15:14:27 +0300 User-Agent: Thunderbird 1.5.0.8 (X11/20061025) MIME-Version: 1.0 To: John Bafford CC: PHP internals References: <76AD94BE-DD27-490D-88F8-8D0EC4A2C4E6@zort.net> In-Reply-To: <76AD94BE-DD27-490D-88F8-8D0EC4A2C4E6@zort.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] New functions: array_key_index(), array_first(), array_last() From: antony@zend.com (Antony Dovgal) On 01/05/2007 08:49 AM, John Bafford wrote: > Hello, > > Attached is a patch and corresponding test file I would like to > submit for inclusion in PHP. I would like this patch to be included > in PHP 5.2.1, as it is entirely new code (and thus shouldn't cause > regressions), but as RC2 was just released earlier today, I > understand if it must wait until PHP 5.2.2. > > This patch implements three new functions, as described below. > > mixed array_key_index(array input, int index [, mixed value]) > Return the array's index'th key (and optionally, value) > > mixed array_first(array input [, mixed value]) > Return the array's first key (and optionally, value) > This is equivalent to array_key_index($input, 0 [, $value]); > > mixed array_last(array input [, mixed value]) > Return the array's last key (and optionally, value) > This is equivalent to array_key_index($input, -1 [, $value]); -1 Implementing these functions _in_ PHP can't take more than a minute. -- Wbr, Antony Dovgal