xref: /PHP-7.4/Zend/tests/neg_num_string.phpt (revision 2c705813)
1--TEST--
2Test edge-cases for negative num strings in interpolated string offsets
3--FILE--
4<?php
5
6$a = [
7    "0" => 1,
8    "-0" => 2,
9    "1" => 3,
10    "-1" => 4,
11    "0x0" => 5,
12    "-0x0" => 6,
13    "00" => 7,
14    "-00" => 8,
15    "9223372036854775808" => 9,
16    "-9223372036854775808" => 10,
17    "2147483648" => 11,
18    "-2147483648" => 12,
19];
20
21var_dump("$a[0]");
22var_dump("$a[-0]");
23var_dump("$a[1]");
24var_dump("$a[-1]");
25var_dump("$a[0x0]");
26var_dump("$a[-0x0]");
27var_dump("$a[00]");
28var_dump("$a[-00]");
29var_dump("$a[9223372036854775808]");
30var_dump("$a[-9223372036854775808]");
31var_dump("$a[2147483648]");
32var_dump("$a[-2147483648]");
33
34?>
35--EXPECT--
36string(1) "1"
37string(1) "2"
38string(1) "3"
39string(1) "4"
40string(1) "5"
41string(1) "6"
42string(1) "7"
43string(1) "8"
44string(1) "9"
45string(2) "10"
46string(2) "11"
47string(2) "12"
48