localtime_basic.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. --TEST--
  2. Test localtime() function : basic functionality
  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() : basic functionality ***\n";
  12. date_default_timezone_set("UTC");
  13. // Initialise all required variables
  14. $timestamp = 10;
  15. $associative_array = true;
  16. // Calling localtime() with all possible arguments
  17. var_dump( localtime($timestamp, $associative_array) );
  18. // Calling localtime() with possible optional arguments
  19. var_dump( localtime($timestamp) );
  20. // Calling localtime() with mandatory arguments
  21. var_dump( localtime() );
  22. ?>
  23. ===DONE===
  24. --EXPECTF--
  25. *** Testing localtime() : basic functionality ***
  26. array(9) {
  27. ["tm_sec"]=>
  28. int(10)
  29. ["tm_min"]=>
  30. int(0)
  31. ["tm_hour"]=>
  32. int(0)
  33. ["tm_mday"]=>
  34. int(1)
  35. ["tm_mon"]=>
  36. int(0)
  37. ["tm_year"]=>
  38. int(70)
  39. ["tm_wday"]=>
  40. int(4)
  41. ["tm_yday"]=>
  42. int(0)
  43. ["tm_isdst"]=>
  44. int(0)
  45. }
  46. array(9) {
  47. [0]=>
  48. int(10)
  49. [1]=>
  50. int(0)
  51. [2]=>
  52. int(0)
  53. [3]=>
  54. int(1)
  55. [4]=>
  56. int(0)
  57. [5]=>
  58. int(70)
  59. [6]=>
  60. int(4)
  61. [7]=>
  62. int(0)
  63. [8]=>
  64. int(0)
  65. }
  66. array(9) {
  67. [0]=>
  68. int(%d)
  69. [1]=>
  70. int(%d)
  71. [2]=>
  72. int(%d)
  73. [3]=>
  74. int(%d)
  75. [4]=>
  76. int(%d)
  77. [5]=>
  78. int(%d)
  79. [6]=>
  80. int(%d)
  81. [7]=>
  82. int(%d)
  83. [8]=>
  84. int(%d)
  85. }
  86. ===DONE===