sandrob57 Posted August 8, 2007 Share Posted August 8, 2007 I have an array with data in this format: $data['chart'] = array (1 => 112, 2 => 223, 3 => 334, 4 => 432, 5 => 111); I need to get it into this format: $chart [ 'chart_data' ] = array ( array ( "chart", "112", "223", "334", "432", "111"); How would I go about doing that? Quote Link to comment https://forums.phpfreaks.com/topic/63823-fun-with-arrays/ Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 that is correct you only missed ) $chart [ 'chart_data' ] = array (array ( "chart", "112", "223", "334", "432", "111")); print_r($chart [ 'chart_data' ]) output is: Array ( [0] => Array ( [0] => chart [1] => 112 [2] => 223 [3] => 334 [4] => 432 [5] => 111 ) ) Quote Link to comment https://forums.phpfreaks.com/topic/63823-fun-with-arrays/#findComment-318085 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.