At 03:37 26.06.2003, John Wulff said:
--------------------[snip]--------------------
>I've got an array in the following format:
>Array ( [Jan-1999] => 36.04,140.35,319.53,324.07 [Feb-1999] =>
>1.78,71.78,320.58,141.97 )
>
>I need it in the following format:
>$example_data = array(
>    array("Feb-1999",1.78,71.78,320.58,141.97),
>    array("Jan-1999",36.04,140.35,319.53,324.07)
>);
--------------------[snip]-------------------- 

This should do:

$array_output = array();
foreach ($array_input as $key => $data) {
   $atmp = explode(',',$data);
   array_unshift($atmp, $key);
   $array_output[] = $atmp;
}

May I ask why you're reformatting the array - maybe you could avoid this step?


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to