The array_column() is an inbuilt function in PHP and is used to return the values from a single column in the input array.
Out of the three parameters, two are mandatory and one is optional. Let’s look at the parameters
As shown in the syntax, the return type of array_column() function is array. That is, the function returns an array which conatins values from a single column of the input array, identified by a column_number. Optionally, an index_key may also be provided to index the values in the returned array by the values from the index_key column of the input array.
In the above example the array_column() function is used to fetch the values of column with key as ‘name’ and these values in the output array are strored with keys which are taken from values of the key ‘roll’ in the original array.