NYCPHP Meetup

NYPHP.org

[nycphp-talk] efficient array manipulation

Tom Melendez tom at supertom.com
Thu Apr 28 17:38:50 EDT 2005


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



More information about the talk mailing list