Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47360 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26562 invoked from network); 17 Mar 2010 15:11:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 15:11:42 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:49590] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 78/14-05162-921F0AB4 for ; Wed, 17 Mar 2010 10:11:41 -0500 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id 0C041E203B; Wed, 17 Mar 2010 15:11:34 +0000 (UTC) Date: Wed, 17 Mar 2010 15:11:34 +0000 (GMT) X-X-Sender: derick@kossu.derickrethans.nl To: Daniel Convissor cc: Felix De Vliegher , PHP internals In-Reply-To: <20100317150205.GA5043@panix.com> Message-ID: References: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> <20100317150205.GA5043@panix.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] array_seek function From: derick@php.net (Derick Rethans) On Wed, 17 Mar 2010, Daniel Convissor wrote: > > $input = array(3, 'bar', 'baz'); > > echo array_seek($input, 2); // returns 'baz' > > echo array_seek($input, 0); // returns 3 > > echo array_seek($input, 5); // returns NULL, emits an out of range warning > > Why waste time calling a function when this can be done right now by > acting on the array itself? Because array keys can be sparse and don't have to be "in order". regards, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug