reverse

Modified on Thu, 9 Jul at 10:49 AM

reverse

TABLE OF CONTENTS

Reverse the order of the argument

Definition

string|array reverse(string|array $argument)

Reverses the order of a string or array $argument.

Parameters

string|array $argument

The string or array to be reversed.

Returns

string|array

The reversed argument.

Examples

Transformation
{
  a: reverse(`[0, 1, 2, 3, 4]`),
  b: reverse(`[]`),
  c: reverse(`["a", "b", "c", 1, 2, 3]`),
  d: reverse(`abcd`),
  e: reverse(`1234`)      // Error
}
Result
{
  "a": [4, 3, 2, 1, 0],
  "b": [],
  "c": [3, 2, 1, "c", "b", "a"],
  "d": "dcba"
}

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