localtime_variation3.phpt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. --TEST--
  2. Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
  3. --FILE--
  4. <?php
  5. /* Prototype : array localtime([int timestamp [, bool associative_array]])
  6. * Description: Returns the results of the C system call localtime as an associative array
  7. * if the associative_array argument is set to 1 other wise it is a regular array
  8. * Source code: ext/date/php_date.c
  9. * Alias to functions:
  10. */
  11. echo "*** Testing localtime() : usage variation ***\n";
  12. date_default_timezone_set("UTC");
  13. // Initialise function arguments not being substituted (if any)
  14. $is_associative = true;
  15. echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
  16. $timestamp = 12.3456789000e10;
  17. var_dump( localtime($timestamp) );
  18. var_dump( localtime($timestamp, $is_associative) );
  19. echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
  20. $timestamp = -12.3456789000e10;
  21. var_dump( localtime($timestamp) );
  22. var_dump( localtime($timestamp, $is_associative) );
  23. ?>
  24. ===DONE===
  25. --EXPECTREGEX--
  26. \*\*\* Testing localtime\(\) : usage variation \*\*\*
  27. -- Testing localtime\(\) function with 'float 12.3456789000e10' to timestamp --
  28. array\(9\) {
  29. \[0\]=>
  30. int\((16|0)\)
  31. \[1\]=>
  32. int\((50|30)\)
  33. \[2\]=>
  34. int\((4|0)\)
  35. \[3\]=>
  36. int\((26|11)\)
  37. \[4\]=>
  38. int\(2\)
  39. \[5\]=>
  40. int\((35|3982)\)
  41. \[6\]=>
  42. int\((2|6)\)
  43. \[7\]=>
  44. int\((84|69)\)
  45. \[8\]=>
  46. int\(0\)
  47. }
  48. array\(9\) {
  49. \["tm_sec"\]=>
  50. int\((16|0)\)
  51. \["tm_min"\]=>
  52. int\((50|30)\)
  53. \["tm_hour"\]=>
  54. int\((4|0)\)
  55. \["tm_mday"\]=>
  56. int\((26|11)\)
  57. \["tm_mon"\]=>
  58. int\(2\)
  59. \["tm_year"\]=>
  60. int\((35|3982)\)
  61. \["tm_wday"\]=>
  62. int\((2|6)\)
  63. \["tm_yday"\]=>
  64. int\((84|69)\)
  65. \["tm_isdst"\]=>
  66. int\(0\)
  67. }
  68. -- Testing localtime\(\) function with 'float -12.3456789000e10' to timestamp --
  69. array\(9\) {
  70. \[0\]=>
  71. int\((44|52|0)\)
  72. \[1\]=>
  73. int\((9|45|30)\)
  74. \[2\]=>
  75. int\((19|20|23)\)
  76. \[3\]=>
  77. int\((8|13|22)\)
  78. \[4\]=>
  79. int\((9|11)\)
  80. \[5\]=>
  81. int\((104|1|-3843)\)
  82. \[6\]=>
  83. int\((5|6)\)
  84. \[7\]=>
  85. int\((281|346|294)\)
  86. \[8\]=>
  87. int\(0\)
  88. }
  89. array\(9\) {
  90. \["tm_sec"\]=>
  91. int\((44|52|0)\)
  92. \["tm_min"\]=>
  93. int\((9|45|30)\)
  94. \["tm_hour"\]=>
  95. int\((19|20|23)\)
  96. \["tm_mday"\]=>
  97. int\((8|13|22)\)
  98. \["tm_mon"\]=>
  99. int\((9|11)\)
  100. \["tm_year"\]=>
  101. int\((104|1|-3843)\)
  102. \["tm_wday"\]=>
  103. int\((5|6)\)
  104. \["tm_yday"\]=>
  105. int\((281|346|294)\)
  106. \["tm_isdst"\]=>
  107. int\(0\)
  108. }
  109. ===DONE===