2 dimensional array to 1 dimensional array

PHOTO EMBED

Mon Nov 30 2020 14:23:00 GMT+0000 (Coordinated Universal Time)

Saved by @vskand #php #array

$oneDimensionalArray = array_map('current', $twoDimensionalArray);

/*
current() function returns the value of the current element in an array. for ex : $fruits = array("banana", "apple", "orange"); echo current($fruits) //will return "banana" since current pointer is on index 0 which is banana
*/
content_copyCOPY

https://stackoverflow.com/questions/8754980/how-to-convert-two-dimensional-array-to-one-dimensional-array-in-php5