"Michael B Allen" <[EMAIL PROTECTED]> wrote:  > On 8/26/07,
Ken Downs <[EMAIL PROTECTED]> wrote: > > look at "each",
it is a (mostly deprecate) form of array iteration.  The > > sample
code in the PHP manual will show exactly what you are looking for. >  >
But again that modifies the array (it advances the cursor).Not really. 
It does not modify the keys or the values.  The cursor is a variable
used to determine which key and value is returned on the next call to
each().If you absolutely must have the state exactly the same before and
after, then add a call to reset() to your code, it is mentioned in that page
in the manual. >  > I guess I can write something myself: >  >
function array_first($array) { >     foreach ($array as $element) >    
    return element; > } >  > > > > > > "Michael B
Allen" <[EMAIL PROTECTED]> wrote: > > > >  > Hi, >
>  > > >  > How do you access the first element of an array?
I'm looking for > >  > something like array_shift but without
modifying the array. > >  > >
_______________________________________________ > New York PHP Community
Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > 
> NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > 
> Show Your Participation in New York PHP >
http://www.nyphp.org/show_participation.php >
_________________________________________________________
This mail sent using V-webmail - http://www.v-webmail.org
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to