1--TEST-- 2Test decbin 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$longVals = array( 16 MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, 17 MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, 18 MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 19); 20 21 22foreach ($longVals as $longVal) { 23 echo "--- testing: $longVal ---\n"; 24 var_dump(decbin($longVal)); 25} 26 27?> 28===DONE=== 29--EXPECT-- 30--- testing: 9223372036854775807 --- 31string(63) "111111111111111111111111111111111111111111111111111111111111111" 32--- testing: -9223372036854775808 --- 33string(64) "1000000000000000000000000000000000000000000000000000000000000000" 34--- testing: 2147483647 --- 35string(31) "1111111111111111111111111111111" 36--- testing: -2147483648 --- 37string(64) "1111111111111111111111111111111110000000000000000000000000000000" 38--- testing: 9223372034707292160 --- 39string(63) "111111111111111111111111111111110000000000000000000000000000000" 40--- testing: -9223372034707292160 --- 41string(64) "1000000000000000000000000000000010000000000000000000000000000000" 42--- testing: 2147483648 --- 43string(32) "10000000000000000000000000000000" 44--- testing: -2147483649 --- 45string(64) "1111111111111111111111111111111101111111111111111111111111111111" 46--- testing: 4294967294 --- 47string(32) "11111111111111111111111111111110" 48--- testing: 4294967295 --- 49string(32) "11111111111111111111111111111111" 50--- testing: 4294967293 --- 51string(32) "11111111111111111111111111111101" 52--- testing: 9223372036854775806 --- 53string(63) "111111111111111111111111111111111111111111111111111111111111110" 54--- testing: 9.2233720368548E+18 --- 55string(64) "1000000000000000000000000000000000000000000000000000000000000000" 56--- testing: -9223372036854775807 --- 57string(64) "1000000000000000000000000000000000000000000000000000000000000001" 58--- testing: -9.2233720368548E+18 --- 59string(64) "1000000000000000000000000000000000000000000000000000000000000000" 60===DONE=== 61