reverse
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
{
a: reverse(`[0, 1, 2, 3, 4]`),
b: reverse(`[]`),
c: reverse(`["a", "b", "c", 1, 2, 3]`),
d: reverse('abcd'),
e: reverse(`1234`) // Error
}
{
"a": [4, 3, 2, 1, 0],
"b": [],
"c": [3, 2, 1, "c", "b", "a"],
"d": "dcba"
}
Updated about 1 year ago