summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/15_reverse
blob: 176cd4cadb5f371a619a4a81542358f10e26a1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
The `reverse()` function returns the input argument in reverse order.

Returns a reversed copy of the input string if the given input value
argument is a string.

Returns a reversed copy of the input array if the given input value
argument is an array.

Returns `null` if the input argument is neither a string nor an array.

-- Testcase --
{%
	printf("%.J\n", [
		reverse("abc"),
		reverse([1, 2, 3]),
		reverse(true)
	]);
%}
-- End --

-- Expect stdout --
[
	"cba",
	[
		3,
		2,
		1
	],
	null
]
-- End --