0
Array ( [0] => rubix ) 
Array ( [0] => limo )
Array ( [0] => icecream )

I need to convert this array into following type. How can I do that? For example like this:

 Array ( [0] => rubix [1] => schoolbag [3] => limo [4] => frezzer [5] => paper )
7
  • Please give some more information. Your question is not clear. Commented Jul 29, 2016 at 14:56
  • where did the elements 'schoolbag' & 'frezzer' come from? Commented Jul 29, 2016 at 14:58
  • Loop through the mother array and newarray.push(array[count][0]) Commented Jul 29, 2016 at 14:59
  • Array ( [0] => rubix ) Array ( [0] => limo ) Array ( [0] => icecream ) coming from database Commented Jul 29, 2016 at 14:59
  • are these separate array just like you've given or multidimensional array like Array([0]=>Array([0]=>rubix) [1]=>Array([0]=>limo)).... Commented Jul 29, 2016 at 15:04

1 Answer 1

0

array_merge() is an option if you want to combine arrays.

$array1 = array("id1" => "rubix ");

$array2 = array("id2" => "limo ", "id3" => "icecream ", "id4" => "frezzer ");

$array3 = array_merge($array1, $array2/*, $arrayN, $arrayN*/);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.