1--TEST--
2Test bindec function : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9
10define("MAX_64Bit", 9223372036854775807);
11define("MAX_32Bit", 2147483647);
12define("MIN_64Bit", -9223372036854775807 - 1);
13define("MIN_32Bit", -2147483647 - 1);
14
15$binLongStrs = array(
16   '0'.str_repeat('1',63),
17   str_repeat('1',64),
18   '0'.str_repeat('1',31),
19   str_repeat('1',32),
20   '0'.str_repeat('1',64),
21   str_repeat('1',65),
22   '0'.str_repeat('1',32),
23   str_repeat('1',33)
24);
25
26
27foreach ($binLongStrs as $strVal) {
28   echo "--- testing: $strVal ---\n";
29   var_dump(bindec($strVal));
30}
31
32?>
33===DONE===
34--EXPECT--
35--- testing: 0111111111111111111111111111111111111111111111111111111111111111 ---
36int(9223372036854775807)
37--- testing: 1111111111111111111111111111111111111111111111111111111111111111 ---
38float(1.844674407371E+19)
39--- testing: 01111111111111111111111111111111 ---
40int(2147483647)
41--- testing: 11111111111111111111111111111111 ---
42int(4294967295)
43--- testing: 01111111111111111111111111111111111111111111111111111111111111111 ---
44float(1.844674407371E+19)
45--- testing: 11111111111111111111111111111111111111111111111111111111111111111 ---
46float(3.6893488147419E+19)
47--- testing: 011111111111111111111111111111111 ---
48int(4294967295)
49--- testing: 111111111111111111111111111111111 ---
50int(8589934591)
51===DONE===
52