xref: /PHP-8.4/ext/standard/tests/array/bug41686.phpt (revision f8d79582)
1--TEST--
2Bug #41686 (Omitting length param in array_slice not possible)
3--FILE--
4<?php
5$a = array(1,2,3);
6$b = array('a'=>1,'b'=>1,'c'=>2);
7
8var_dump(
9        array_slice($a, 1),
10        array_slice($a, 1, 2, TRUE),
11        array_slice($a, 1, NULL, TRUE),
12        array_slice($b, 1),
13        array_slice($b, 1, 2, TRUE),
14        array_slice($b, 1, NULL, TRUE)
15);
16
17echo "Done\n";
18?>
19--EXPECT--
20array(2) {
21  [0]=>
22  int(2)
23  [1]=>
24  int(3)
25}
26array(2) {
27  [1]=>
28  int(2)
29  [2]=>
30  int(3)
31}
32array(2) {
33  [1]=>
34  int(2)
35  [2]=>
36  int(3)
37}
38array(2) {
39  ["b"]=>
40  int(1)
41  ["c"]=>
42  int(2)
43}
44array(2) {
45  ["b"]=>
46  int(1)
47  ["c"]=>
48  int(2)
49}
50array(2) {
51  ["b"]=>
52  int(1)
53  ["c"]=>
54  int(2)
55}
56Done
57