values

Modified on Thu, 9 Jul at 10:50 AM

values

TABLE OF CONTENTS

Get an array of the values of an object

Definition

array values(object $obj)

Returns an array containing the keys of the provided object. Note that, because JSON hashes are inherently unordered, the values associated with $obj are inherently unordered.

Parameters

object $obj

Object to return the values of.

Returns

array

Array of the values of $obj.

Examples

Transformation
{   
  a: values({name: 'Juliet', age:`13`}),
  b: values(`{}`),
  c: values(`false`),
  d: values(['b', 'a', 'c'])
}
Result
{
  "a": [
    "Juliet",
    13
  ],
  "b": []
}

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