NYCPHP Meetup

NYPHP.org

[nycphp-talk] efficient array manipulation

Joel De Gan joel at tagword.com
Thu Apr 28 19:54:14 EDT 2005


See: 
http://us2.php.net/manual/en/function.array-map.php


On Thu, 2005-04-28 at 17:38, Tom Melendez wrote:
> Hey Folks,
> 
> Say I have a two-dimensional array with 5000 items in it.
> 
> I need to turn an array that looks like this:
> 
> $myarray[0][0]="foo";
> 
> into
> 
> $myarray[0][0][element1]=foo (the value of the original $myarray[0][0])
> $myarray[0][0][element2]=some_value_that_never_changes
> 
> I'm looking for the most efficient way possible to do this.  I really 
> don't want to use a loop, I'm looking at array_walk now, but I'm hoping 
> there is a "one or two liner" that is efficient and easy.
> 
> Any thoughts?
> 
> Thanks,
> 
> Tom
> http://www.liphp.org
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 
-- 
joeldg - developer, Intercosmos media group.
http://lucifer.intercosmos.net




More information about the talk mailing list