NYCPHP Meetup

NYPHP.org

[nycphp-talk] Array Transformation Assistance.

Peter Sawczynec ps at pswebcode.com
Mon Oct 2 15:04:47 EDT 2006


Go ahead chuckle it up. But, yes, I need this one little one. 
I begin with a numerically indexed array of elements (could be any length):
 
$master_names  = array("Joe", "Sam", "Tom" ... )
 
I need to rename all the array elements as to make a matching consistent
associative array.
And... the keys in the associative array must be derived from combining the
name of the array 
(in this example 'master_names') with the correct former index value
appended on the end of 
each new key:
 
$master_names = array('master_names0'=>"Joe", 'master_names1'=>"Sam,
'master_names2'=>"Tom" ... ) 
 
 
OR
 
$master_names[0]="Joe"
$master_names[1]="Sam"
$master_names[2]="Tom"
 
becomes...
 
$master_names['master_names0']="Joe"
$master_names['master_names1']="Sam"
$master_names['master_names2']="Tom"
 
 
Yes, that is it.
 
Warmest regards, 
 
Peter Sawczynec 
Technology Director 
PSWebcode 
_Design & Interface 
_Ecommerce 
_Database Management 
646.316.3678 
ps at pswebcode.com 
www.pswebcode.com <http://www.pswebcode.com/>  
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20061002/979ec48f/attachment.html>


More information about the talk mailing list