items

Modified on Thu, 9 Jul at 10:50 AM

items

TABLE OF CONTENTS

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

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

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article