Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23411 invoked from network); 17 Mar 2010 15:07:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 15:07:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.224 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.220.224 mail-fx0-f224.google.com Received: from [209.85.220.224] ([209.85.220.224:55296] helo=mail-fx0-f224.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/73-05162-C30F0AB4 for ; Wed, 17 Mar 2010 10:07:40 -0500 Received: by fxm24 with SMTP id 24so614249fxm.23 for ; Wed, 17 Mar 2010 08:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=9OWDgnR+0n6U43+vORULznTWErBDF7h511Hdf1gp9Lg=; b=e/+xO2Kuu6IebRH0Z3sVuF+xMuWTd/UuYbdhHGEg+9lAQNCalqkfSk/pXUAZ6cp6bq MltTScu1MExVfA6uPQ5RzAfgkXNx6SvkmGXEPrkd6DrFhXFXWnz6gLu6nCA8LCjQKSR2 CZtG7yyglTg7IxMynL3z6GLnJhAIq+MfmZ7r8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=DIeOanzVScRQ0sKCZmM+hzqeVpwiLOs3wZ16UnFXtpZ6Nyxkq6XgDe353Nr1VUuK4b CgsVLQ9g1EbKr5DXEFI2PlLaluj1DE1+LFpmdMh8uASpPPhvRPNMZmk5Wz5DBwCeUbc2 1Pps1M7WgKnG0SbC/rqNd0+RhGy0TGq3yiI5A= MIME-Version: 1.0 Received: by 10.216.89.139 with SMTP id c11mr569085wef.198.1268838456735; Wed, 17 Mar 2010 08:07:36 -0700 (PDT) In-Reply-To: <20100317150205.GA5043@panix.com> References: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> <20100317150205.GA5043@panix.com> Date: Wed, 17 Mar 2010 16:07:36 +0100 Message-ID: To: Daniel Convissor Cc: Felix De Vliegher , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] array_seek function From: pierre.php@gmail.com (Pierre Joye) On Wed, Mar 17, 2010 at 4:02 PM, Daniel Convissor wrote: > Hi: > >> $input =3D 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 warni= ng > > Why waste time calling a function when this can be done right now by > acting on the array itself? Please double check what the patch does, test it, and think again about this question (hint: pos !=3D key) :) Cheers, > $input =3D array(3, 'bar', 'baz'); > echo $input[2]; // returns 'baz' > echo $input[0]; // returns 3 > echo $input[5]; // returns NULL, Notice: Undefined offset: 5 > > --Dan > > -- > =A0T H E =A0 A N A L Y S I S =A0 A N D =A0 S O L U T I O N S =A0 C O M P = A N Y > =A0 =A0 =A0 =A0 =A0 =A0data intensive web and database programming > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0http://www.AnalysisAndSolutions.com/ > =A04015 7th Ave #4, Brooklyn NY 11232 =A0v: 718-854-0335 f: 718-854-0409 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org