Re: array_seek function
| From: | Daniel Convissor | Date: | Wed, 17 Mar 2010 15:02:06 +0000 |
| Subject: | Re: array_seek function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47358@lists.php.net to get a copy of this message | ||
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