I had gone through many questions regarding the array conversion but didnt gwt a solution for my problem.
I have an array as follows
array:5 [ 0 => array:1 [ 1 => "012" ] 1 => array:1 [ 1 => "020" ] 2 => array:1 [ 1 => "030" ] 3 => array:1 [ 1 => "040" ] 4 => array:1 [ 1 => "051" ] ]
I want to make this in the following format
["012","020","030","040","051"]
I have tried json encode and got a result as
[{"1":"012"},{"1":"020"},{"1":"030"},{"1":"040"},{"1":"051"}]
which is not i wanted.Hope someone could help.
Advertisement
Answer
array_column($inputArray, 1);