octal_32bit.phpt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. --TEST--
  2. Octal integer strings (32bit)
  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. /* Using octal prefix notation lowercase */
  10. /* Maximum value representable as integer */
  11. $octal = 0o17777777777;
  12. var_dump($octal);
  13. var_dump(PHP_INT_MAX);
  14. /* Floating number */
  15. $octal = 0o45734321536435450000000000;
  16. var_dump($octal);
  17. /* Integer */
  18. $octal = 0o16;
  19. var_dump($octal);
  20. /* underscore separator */
  21. $octal = 0o1_6;
  22. var_dump($octal);
  23. /* Ignore leading 0 and _ */
  24. $octal = 0o0_016;
  25. var_dump($octal);
  26. $octal = 0o0_16;
  27. var_dump($octal);
  28. /* Overflow to infinity */
  29. $octal = 0o77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
  30. var_dump($octal);
  31. /* Using octal prefix notation uppercase */
  32. /* Maximum value representable as integer */
  33. $octal = 0O17777777777;
  34. var_dump($octal);
  35. var_dump(PHP_INT_MAX);
  36. /* Floating number */
  37. $octal = 0O45734321536435450000000000;
  38. var_dump($octal);
  39. /* Integer */
  40. $octal = 0O16;
  41. var_dump($octal);
  42. /* underscore separator */
  43. $octal = 0O1_6;
  44. var_dump($octal);
  45. /* Ignore leading 0 and _ */
  46. $octal = 0O0_016;
  47. var_dump($octal);
  48. $octal = 0O0_16;
  49. var_dump($octal);
  50. /* Overflow to infinity */
  51. $octal = 0O77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
  52. var_dump($octal);
  53. /* Using no dedicated prefix */
  54. /* Maximum value representable as integer */
  55. $octal = 017777777777;
  56. var_dump($octal);
  57. var_dump(PHP_INT_MAX);
  58. /* Floating number */
  59. $octal = 045734321536435450000000000;
  60. var_dump($octal);
  61. /* Integer */
  62. $octal = 016;
  63. var_dump($octal);
  64. /* underscore separator */
  65. $octal = 01_6;
  66. var_dump($octal);
  67. /* Ignore leading 0 and _ */
  68. $octal = 00_016;
  69. var_dump($octal);
  70. $octal = 0_16;
  71. var_dump($octal);
  72. /* Overflow to infinity */
  73. $octal = 077777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
  74. var_dump($octal);
  75. ?>
  76. --EXPECT--
  77. int(2147483647)
  78. int(2147483647)
  79. float(1.7912166229916324E+23)
  80. int(14)
  81. int(14)
  82. int(14)
  83. int(14)
  84. float(INF)
  85. int(2147483647)
  86. int(2147483647)
  87. float(1.7912166229916324E+23)
  88. int(14)
  89. int(14)
  90. int(14)
  91. int(14)
  92. float(INF)
  93. int(2147483647)
  94. int(2147483647)
  95. float(1.7912166229916324E+23)
  96. int(14)
  97. int(14)
  98. int(14)
  99. int(14)
  100. float(INF)