Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19419 invoked from network); 17 Mar 2010 15:02:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 15:02:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=danielc@analysisandsolutions.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danielc@analysisandsolutions.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain analysisandsolutions.com from 166.84.1.72 cause and error) X-PHP-List-Original-Sender: danielc@analysisandsolutions.com X-Host-Fingerprint: 166.84.1.72 mail1.panix.com Received: from [166.84.1.72] ([166.84.1.72:61794] helo=mail1.panix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/92-05162-1FEE0AB4 for ; Wed, 17 Mar 2010 10:02:10 -0500 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mail1.panix.com (Postfix) with ESMTP id 8D82C1F088; Wed, 17 Mar 2010 11:02:06 -0400 (EDT) Received: by panix5.panix.com (Postfix, from userid 14662) id 87C8324258; Wed, 17 Mar 2010 11:02:06 -0400 (EDT) Date: Wed, 17 Mar 2010 11:02:06 -0400 To: Felix De Vliegher Cc: PHP internals Message-ID: <20100317150205.GA5043@panix.com> References: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6E76B52E-7543-4F09-A948-A7910513B548@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [PHP-DEV] array_seek function From: danielc@analysisandsolutions.com (Daniel Convissor) Hi: > $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? $input = array(3, 'bar', 'baz'); echo $input[2]; // returns 'baz' echo $input[0]; // returns 3 echo $input[5]; // returns NULL, Notice: Undefined offset: 5 --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409