items_to_object
TABLE OF CONTENTS
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
Transformation
{
object: items_to_object([['a','b'],['c','d']]),
empty: items_to_object([])
}Result
{
"object": {
"a": "b",
"c": "d"
},
"b": null
}Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article