xref: /PHP-8.4/ext/standard/tests/array/bug24766.phpt (revision e2c8ab7c)
1--TEST--
2Bug #24766 (strange result array from unpack)
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8$a = unpack('C2', "\0224V");
9$b = array(1 => 18, 2 => 52);
10var_dump($a, $b);
11$k = array_keys($a);
12$l = array_keys($b);
13var_dump($k, $l);
14$i=$k[0];
15var_dump($a[$i]);
16$i=$l[0];
17var_dump($b[$i]);
18?>
19--EXPECT--
20array(2) {
21  [1]=>
22  int(18)
23  [2]=>
24  int(52)
25}
26array(2) {
27  [1]=>
28  int(18)
29  [2]=>
30  int(52)
31}
32array(2) {
33  [0]=>
34  int(1)
35  [1]=>
36  int(2)
37}
38array(2) {
39  [0]=>
40  int(1)
41  [1]=>
42  int(2)
43}
44int(18)
45int(18)
46