hexdec_basic.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test hexdec() - basic function test hexdec()
  3. --SKIPIF--
  4. <?php
  5. if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
  6. ?>
  7. --FILE--
  8. <?php
  9. $values = array(0x123abc,
  10. 0x789DEF,
  11. 0x7FFFFFFF,
  12. 0x80000000,
  13. '0x123abc',
  14. '0x789DEF',
  15. '0x7FFFFFFF',
  16. '0x80000000',
  17. '0x123XYZABC',
  18. 311015,
  19. '311015',
  20. 31101.3,
  21. 31.1013e5,
  22. 011237,
  23. '011237',
  24. true,
  25. false,
  26. );
  27. for ($i = 0; $i < count($values); $i++) {
  28. $res = hexdec($values[$i]);
  29. var_dump($res);
  30. }
  31. ?>
  32. --EXPECTF--
  33. int(18433668)
  34. int(126895953)
  35. float(142929835591)
  36. float(142929835592)
  37. int(1194684)
  38. int(7904751)
  39. int(2147483647)
  40. float(2147483648)
  41. Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  42. int(1194684)
  43. int(3215381)
  44. int(3215381)
  45. Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  46. int(3215379)
  47. int(51446064)
  48. int(18279)
  49. int(70199)
  50. int(1)
  51. int(0)