items_to_object
Convert a two-dimensional array to an object
Definition
object items_to_object(array[array] $input)
Returns an object consisting of key-value pairs from a two-dimensional array.
Parameters
array[array] $input
A two-dimensional array.
Returns
object
The object representing $input as key-value pairs.
Examples
{
object: items_to_object([['a','b'],['c','d']]),
empty: items_to_object([])
}{
"object": {
"a": "b",
"c": "d"
},
"b": null
}Updated 11 days ago