1--TEST-- 2Test hexdec() - basic function test hexdec() 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 6?> 7--FILE-- 8<?php 9echo "*** Testing hexdec() : basic functionality ***\n"; 10 11$values = array(0x123abc, 12 0x789DEF, 13 0x7FFFFFFF, 14 0x80000000, 15 '0x123abc', 16 '0x789DEF', 17 '0x7FFFFFFF', 18 '0x80000000', 19 '0x123XYZABC', 20 311015, 21 '311015', 22 31101.3, 23 31.1013e5, 24 011237, 25 '011237', 26 true, 27 false, 28 null); 29 30foreach($values as $value) { 31 echo "\n-- hexdec $value --\n"; 32 var_dump(hexdec($value)); 33}; 34 35?> 36===Done=== 37--EXPECTF-- 38*** Testing hexdec() : basic functionality *** 39 40-- hexdec 1194684 -- 41int(18433668) 42 43-- hexdec 7904751 -- 44int(126895953) 45 46-- hexdec 2147483647 -- 47int(142929835591) 48 49-- hexdec 2147483648 -- 50int(142929835592) 51 52-- hexdec 0x123abc -- 53int(1194684) 54 55-- hexdec 0x789DEF -- 56int(7904751) 57 58-- hexdec 0x7FFFFFFF -- 59int(2147483647) 60 61-- hexdec 0x80000000 -- 62int(2147483648) 63 64-- hexdec 0x123XYZABC -- 65int(1194684) 66 67-- hexdec 311015 -- 68int(3215381) 69 70-- hexdec 311015 -- 71int(3215381) 72 73-- hexdec 31101.3 -- 74int(3215379) 75 76-- hexdec 3110130 -- 77int(51446064) 78 79-- hexdec 4767 -- 80int(18279) 81 82-- hexdec 011237 -- 83int(70199) 84 85-- hexdec 1 -- 86int(1) 87 88-- hexdec -- 89int(0) 90 91-- hexdec -- 92int(0) 93===Done=== 94