items

Convert an object into an array of its properties

Definition

array items(object $object)

Converts an object into an array where each key-value pair is turned into a two-element subarray of key and value.

Parameters

object $object

Object to convert to array.

Returns

array

Array representation of $object.

Examples

{
  items: items({name1: 'value1', name2: 'value2'}),
  empty: items(`{}`)
}
{
  "items": [
    [
      "name1",
      "value1"
    ],
    [
      "name2",
      "value2"
    ]
  ],
  "empty": []
}