-2

is there any way to convert the below array to normal array in php ?

[["2"],["2","3","4"],["8","9"],["7","4"]]


["2","3","4","8","9","7"]
user3755787
  • 71
  • 1
  • 1
  • 6
  • Possible duplicate of [How to Flatten a Multidimensional Array?](http://stackoverflow.com/questions/1319903/how-to-flatten-a-multidimensional-array) – Fabian Winkler Nov 23 '15 at 12:05

1 Answers1

6

Flatten the 2d array using something like call_user_func_array('array_merge', $array);. Then call array_unique() to eliminate the duplicates, and sort() if necessary.

$newArray = array_unique(call_user_func_array('array_merge', $oldArray));
sort($newArray);

Demo

Mark Baker
  • 209,507
  • 32
  • 346
  • 385