php - what is the easiest way to change this array to 1D array -


What is the easiest way to change this array in the 1d array, I can do this for loop or foreign use, but I'm curious to see if there is any easy way. Thank you

  array ([0] = & gt; array ([ID] => 1) [1] => Hey ([ID] => 2) [ 1] => >  output_ar = Array_map ('array_shift', $ input_ar);  

The array_shift () function grabs the key / val pair and returns the value of a key, so apply it to each array in its header. The combination - the blue array, and the combination of results, will result in a 1-D list of IDs.

If your arrays actually have more information than their ID area, then you might want to define a function that pulls the fields you want and gives them, and then Use array_map with that function.


Comments