increment_001.phpt 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --TEST--
  2. incrementing different variables
  3. --SKIPIF--
  4. <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
  5. --INI--
  6. precision=14
  7. --FILE--
  8. <?php
  9. $a = array(
  10. array(1,2,3),
  11. "",
  12. 1,
  13. 2.5,
  14. 0,
  15. "string",
  16. "123",
  17. "2.5",
  18. NULL,
  19. true,
  20. false,
  21. new stdclass,
  22. array(),
  23. PHP_INT_MAX,
  24. (string)PHP_INT_MAX
  25. );
  26. foreach ($a as $var) {
  27. try {
  28. $var++;
  29. } catch (TypeError $e) {
  30. echo $e->getMessage(), "\n";
  31. }
  32. var_dump($var);
  33. }
  34. echo "Done\n";
  35. ?>
  36. --EXPECTF--
  37. Cannot increment array
  38. array(3) {
  39. [0]=>
  40. int(1)
  41. [1]=>
  42. int(2)
  43. [2]=>
  44. int(3)
  45. }
  46. string(1) "1"
  47. int(2)
  48. float(3.5)
  49. int(1)
  50. string(6) "strinh"
  51. int(124)
  52. float(3.5)
  53. int(1)
  54. bool(true)
  55. bool(false)
  56. Cannot increment stdClass
  57. object(stdClass)#%d (0) {
  58. }
  59. Cannot increment array
  60. array(0) {
  61. }
  62. float(2147483648)
  63. float(2147483648)
  64. Done