wotw Posted January 17, 2013 Share Posted January 17, 2013 Hey, Could someone help me move these arrays into one array please? i.e move them up one level. Array ( [0] => Array ( [0] => content_first ) [1] => Array ( [0] => content_again [1] => content ) } Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/273258-move-arrays-up/ Share on other sites More sharing options...
trq Posted January 17, 2013 Share Posted January 17, 2013 array_merge Quote Link to comment https://forums.phpfreaks.com/topic/273258-move-arrays-up/#findComment-1406266 Share on other sites More sharing options...
wotw Posted January 19, 2013 Author Share Posted January 19, 2013 (edited) Problem with using is the array is built like this: function files(){ $file_array = $this->files; $files = array(); foreach($file_array as $value){ $files[] = $value['files']; } return $files; } That funcxtion is from a class file. That functiopn returns the array posted above. How can I make all the valueas into one array mate? Edited January 19, 2013 by wotw Quote Link to comment https://forums.phpfreaks.com/topic/273258-move-arrays-up/#findComment-1406924 Share on other sites More sharing options...
silkfire Posted January 19, 2013 Share Posted January 19, 2013 Replace the line: $files[] = $values['files']; with $files = array_merge($files, $values['files']); Quote Link to comment https://forums.phpfreaks.com/topic/273258-move-arrays-up/#findComment-1406927 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.