Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47372 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55193 invoked from network); 17 Mar 2010 16:30:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 16:30:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=patrick.allaert@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.78.24 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 74.125.78.24 ey-out-2122.google.com Received: from [74.125.78.24] ([74.125.78.24:43887] helo=ey-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/D9-05162-09301AB4 for ; Wed, 17 Mar 2010 11:30:09 -0500 Received: by ey-out-2122.google.com with SMTP id 25so135455eya.39 for ; Wed, 17 Mar 2010 09:30:06 -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=EjSCMIIJ7rNDJadPHICLa9Zf4KBMesFh2HvJ3JaA/6E=; b=t9vcX47PnepPeoDyQ+yfe/rWQ5VCWIy7m5C8fHmM7HcpGtVdC5PTCsMu4sYnA0T8TH n1Ef1BsdmWoS+jMXu8LP16kSOC2mRhGHa23eW6oaa7b21QwmCWl69nIQ3AMw2GqFeIj+ 9jJJz6TiUmbaUkY84wwJnkPU1mp6ey+2HKpYA= 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=uzhgyCrvZ7xLNPgB/wPxIInsGIEVAHaZOAC/2dpMhTQzFJJbUMg07gAbrhqsE/eFRj Ilmtydh+2mEyvdkb0XdtMgX+boW+8YAz6fRVNlBNBYqBAp//2fc84dIiQf06vJNS6G3U qWcpyWVqCTVp3JOR+5+ghhNSImP7coXyjlb4g= MIME-Version: 1.0 Sender: patrick.allaert@gmail.com Received: by 10.216.165.67 with SMTP id d45mr565633wel.28.1268843405563; Wed, 17 Mar 2010 09:30:05 -0700 (PDT) In-Reply-To: <72EAF587-5446-4285-8266-45D95AEAC471@gmail.com> References: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> <72EAF587-5446-4285-8266-45D95AEAC471@gmail.com> Date: Wed, 17 Mar 2010 17:30:05 +0100 X-Google-Sender-Auth: b9ad0a9eef83c122 Message-ID: To: Felix De Vliegher Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] array_seek function From: patrickallaert@php.net (Patrick ALLAERT) > Hi Patrick > > That's of course possible, but that would only allow seeking to a relativ= e position to where the array pointer is at that moment. The functionality = also gets a bit ambiguous by adding an optional parameter. You're not going= to the next or prev position of the array anymore. You could always use reset() in combination with next($int). The main benefit I see doing so is that you can do something like: reset($array); $jump =3D 3; while ($elem =3D next($jump)) { // Some treatment that needs to be done on every $jump element } Which would be slower and less readable with array_seek() of course, depends on your use case! > And I think functions like next, prev, current etc should be kept easy to= use. If you want seek-like functionality, use the designated array functio= n for that (if this one should make it into php, that is). Well, it wouldn't be a mandatory option of course for BC. It would jump forward/backward X elements just where X is 1 by default. It could make sense to have both maybe? Let's wait other's opinion. Cheers, Patrick