array_column() To Hash¶
array_column() is a very handy PHP native function, which extracts a index from a list of arrays, or a public property from a list of objects.
The third argument of array_column() is a key, which will be used to reference the value in the resulting array. It is very convenient to turn an array into a hash.
Note that duplicate keys will be overwritten.
Also, there is no reciprocal function for this: turn a hash into an array of arrays or objects.
See Also¶
Magic constants [Try me]