-2

I have a multidimensional array

Array ( 
[0] => Array ( [0] => 4 [1] => 2200 ) 
[1] => Array ( [0] => 7 [1] => 2050 ) 
[2] => Array ( [0] => 2 [1] => 1000 ) 
[3] => Array ( [0] => 3 [1] => 900 ) 
[4] => Array ( [0] => 8 [1] => 430 ) 
[5] => Array ( [0] => 5 [1] => 400 ) 
[6] => Array ( [0] => 1 [1] => 200 ) 
[7] => Array ( [0] => 6 [1] => 20 ) 
)

I would like to take all the column 0 and turn it into its own array. How can I do this without using loops?

I have used loops but I want a cleaner way.

Darren
  • 13,050
  • 4
  • 41
  • 79
user3565264
  • 157
  • 2
  • 10

1 Answers1

2

array_column do the job. (php >= 5.5)

For php < 5.5 see this comment.

Federkun
  • 36,084
  • 8
  • 78
  • 90