Hello what is the easiest way to change this array to 1D array, i can do that using for loop or foreach, but i'm curious to check if there is an easier way. THANKS
Array (  => Array ( [id] => 1 )  => Array ( [id] => 2 )  => Array ( [id] => 3 ) )
$output_ar = array_map('array_shift', $input_ar);
array_shift() function grabs the first key/val pair out of an array and returns the value, so applying it to each of the arrays in your top-level array, and combining the results, will result in a 1-d list of the id's.
If your arrays actually have more info than just the id field in them, then you'd probably want to define a function that specifically pulls out whatever field(s) you want and returns those, and then use that function with
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki