#Introduction
array_column is one of my favorite functions in PHP. When you are dealing with a multidimensional array and want to extract a specific piece of data from that structure, array_column is extremely helpful. By passing the array and specifying the key name, you can extract the values of that key separately from the original array.
Below is an example of this function and its output:

#Arguments
- #1 multidimensional array that we want to extract data from
- #2 key name whose values we want to retrieve separately
You can also use the third argument of this function, which allows you to set a custom index key for the resulting array. This can be helpful when you want to structure the output in a more meaningful way.
#Result
- array containing the values of the specified key
- empty array If no matching key is found
#Use Cases
This function can be used in many scenarios. Data returned from a database, an external API, or even internal calculations is often multidimensional, and we may only need a specific part of that data. This is where array_column becomes very useful.
If you are familiar with Laravel, there is a function called pluck that performs almost the same task. This similarity highlights how useful and important this function is.
From now on, instead of using loops or complex logic, try using array_column.