Forum Moderators: coopster

Message Too Old, No Replies

Make an associative massive

         

orion_rus

7:28 am on Jan 24, 2006 (gmt 0)

10+ Year Member



Hello world, i have a following common array:
$array[0..250]=array('a','b','c');
and i need to make this:
$multarray['a']['b']['c']=0..250;

how i can make it?
Thanks in advance

coopster

10:51 pm on Jan 24, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about looping through and reversing them?
$array = array('0..250' => array('a','b','c')); 
foreach ($array as $k => $v) {
foreach ($v as $val) {
$multarray[$val] = $k;
}
}
print_r($array);
print_r($multarray);