|
array_columnReturn the values from a single column in the input array Description
array array_column
( array
$array
, mixed $column_key
[, mixed $index_key = null
] )
array_column returns the values from a single column of
the Parameters
Return ValuesReturns an array of values representing a single column from the input array. Examples
Example #1 Get column of first names from recordset
<?phpThe above example will output:
Array
(
[0] => John
[1] => Sally
[2] => Jane
[3] => Peter
)
Example #2 Get column of last names from recordset, indexed by the "id" column
<?phpThe above example will output:
Array
(
[2135] => Doe
[3245] => Smith
[5342] => Jones
[5623] => Doe
)
|