Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51896 invoked from network); 16 Mar 2010 16:12:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2010 16:12:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=mikko.koppanen@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mikko.koppanen@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.215 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mikko.koppanen@gmail.com X-Host-Fingerprint: 209.85.220.215 mail-fx0-f215.google.com Received: from [209.85.220.215] ([209.85.220.215:51221] helo=mail-fx0-f215.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/F5-15129-4EDAF9B4 for ; Tue, 16 Mar 2010 11:12:20 -0500 Received: by fxm7 with SMTP id 7so100039fxm.23 for ; Tue, 16 Mar 2010 09:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=5GRVNAE/CXt/C7CQJf3hig/G5oCNCPiZuewirxNxIFw=; b=HhYzXSDkpyfS9/arlkbKJaMfq6RkTTptxFPy7PBDuOIPQieeox3ZORoXTLQbEk8pKH 26muKsjZsXByJPXowyNo/mN8HoQQT9+HVssO7C3eio7qu+vmneUaSlehSrO07jTiKlPb wpgPeijoQEqAOKcENujr+aqRSw5hjT+Uk6GHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=xc1FTKQl5/L+2FM7CXfNAQbvSRC57XYPx/baA6V9qgCsrxfeo+O8x0RvGYHDv9jw0O oksFqf5BWX0ECjsGymAImbfQzcvg5NQ6AxsZIv7K4bjqm5wMOEozBjnui52rzG5Au9f6 MmefybOD0iehZ6XEwFlErA4ZbQLc8xvRtopR0= MIME-Version: 1.0 Sender: mikko.koppanen@gmail.com Received: by 10.223.2.134 with SMTP id 6mr157016faj.71.1268755936059; Tue, 16 Mar 2010 09:12:16 -0700 (PDT) In-Reply-To: <4B9F91E9.1000100@cschneid.com> References: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> <4B9F91E9.1000100@cschneid.com> Date: Tue, 16 Mar 2010 16:12:15 +0000 X-Google-Sender-Auth: 01d0a8d3ad07cc63 Message-ID: <8cf711461003160912m6ab0ecf4ga08ed7dc82375073@mail.gmail.com> To: Christian Schneider Cc: Felix De Vliegher , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: array_seek function From: mkoppanen@php.net (Mikko Koppanen) On Tue, Mar 16, 2010 at 2:12 PM, Christian Schneider wrote > I thinks the user space implementation > > function array_seek($array, $pos) > { > =A0 =A0 =A0 =A0$a =3D array_values($array); > =A0 =A0 =A0 =A0return $a[$pos]; > } > > is simple enough to not add a native function for this. > > It might not be the most efficient way to do it but I doubt that it is > something done frequently enough to justify another native function. Hi, slightly modified version of the original patch http://valokuva.org/~mikko/array_seek.patch.txt. The difference to the original is that the iterator position is left where the user seeked to. So something like following should work: Not sure how useful it is to have this in core but I do remember for looking for a seek function for arrays before. --=20 Mikko Koppanen