PageRenderTime 51ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/date/tests/gmmktime_variation6.php

http://github.com/facebook/hiphop-php
PHP | 94 lines | 53 code | 20 blank | 21 comment | 0 complexity | 1b1dc3f7cee6eab8b21b82b9e24dfaec MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. /* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
  3. * Description: Get UNIX timestamp for a GMT date
  4. * Source code: ext/date/php_date.c
  5. * Alias to functions:
  6. */
  7. echo "*** Testing gmmktime() : usage variation ***\n";
  8. // Initialise function arguments not being substituted (if any)
  9. $hour = 8;
  10. $min = 8;
  11. $sec = 8;
  12. $mon = 8;
  13. $day = 8;
  14. //get an unset variable
  15. $unset_var = 10;
  16. unset ($unset_var);
  17. // define some classes
  18. class classWithToString
  19. {
  20. public function __toString() {
  21. return "Class A object";
  22. }
  23. }
  24. class classWithoutToString
  25. {
  26. }
  27. // heredoc string
  28. $heredoc = <<<EOT
  29. hello world
  30. EOT;
  31. // add arrays
  32. $index_array = array (1, 2, 3);
  33. $assoc_array = array ('one' => 1, 'two' => 2);
  34. //array of values to iterate over
  35. $inputs = array(
  36. // float data
  37. 'float 10.5' => 10.5,
  38. 'float .5' => .5,
  39. // array data
  40. 'empty array' => array(),
  41. 'int indexed array' => $index_array,
  42. 'associative array' => $assoc_array,
  43. 'nested arrays' => array('foo', $index_array, $assoc_array),
  44. // null data
  45. 'uppercase NULL' => NULL,
  46. 'lowercase null' => null,
  47. // boolean data
  48. 'lowercase true' => true,
  49. 'lowercase false' =>false,
  50. 'uppercase TRUE' =>TRUE,
  51. 'uppercase FALSE' =>FALSE,
  52. // empty data
  53. 'empty string DQ' => "",
  54. 'empty string SQ' => '',
  55. // string data
  56. 'string DQ' => "string",
  57. 'string SQ' => 'string',
  58. 'mixed case string' => "sTrInG",
  59. 'heredoc' => $heredoc,
  60. // object data
  61. 'instance of classWithToString' => new classWithToString(),
  62. 'instance of classWithoutToString' => new classWithoutToString(),
  63. // undefined data
  64. 'undefined var' => @$undefined_var,
  65. // unset data
  66. 'unset var' => @$unset_var,
  67. );
  68. // loop through each element of the array for year
  69. foreach($inputs as $key =>$value) {
  70. echo "\n--$key--\n";
  71. var_dump( gmmktime($hour, $min, $sec, $mon, $day, $value) );
  72. };
  73. ?>
  74. ===DONE===