"Michael B Allen" <[EMAIL PROTECTED]> wrote: > > >
> > > Um, you could, uh, write a function called array_first() that
does the > > reset() and then calls each()?  Then maybe even calls
reset() again?  Then > > you could, like, maybe, only use this function
and not make arbitrary use of > > each() and reset() in your code? > 
> I guess you missed my earlier post. This is what I'm using right now:
>  > function _array_first($a, $want_key=FALSE) { >     foreach ($a
as $key => $elem) >         return $want_key ? $key : $elem; >    
return FALSE; > } >  > > And btw, when you write that function,
pass the array by reference, not by > > value.No, I caught your post,
it's just that an experienced PHP programmer would never write the function
you wrote to do what you're doing.  They'd use each().Hint: read the
manual to find find out why I told you to pass by reference, read the manual
to find out what foreach does internally.Have a nice day.--Ken DownsSecure
Data Softwarewww.secdat.com631-689-7200631-379-0010
_________________________________________________________
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