make test runner work in open source repo
[hiphop-php.git] / hphp / test / zend / bad / ext-date / date_sunset_variation6.php
blobe1f2e1c2ebe4bb0b40c31bcdbc39503d50af67e2
1 <?php
2 /* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
3 * Description: Returns time of sunset for a given day and location
4 * Source code: ext/date/php_date.c
5 * Alias to functions:
6 */
8 echo "*** Testing date_sunset() : usage variation ***\n";
10 // Initialise function arguments not being substituted (if any)
11 date_default_timezone_set("Asia/Calcutta");
12 $time = mktime(8, 8, 8, 8, 8, 2008);
13 $longitude = 88.21;
14 $latitude = 22.34;
15 $zenith = 90;
17 //get an unset variable
18 $unset_var = 10;
19 unset ($unset_var);
21 // define some classes
22 class classWithToString
24 public function __toString() {
25 return "Class A object";
29 class classWithoutToString
33 // heredoc string
34 $heredoc = <<<EOT
35 hello world
36 EOT;
38 // add arrays
39 $index_array = array (1, 2, 3);
40 $assoc_array = array ('one' => 1, 'two' => 2);
42 //array of values to iterate over
43 $inputs = array(
45 // int data
46 'int 0' => 0,
47 'int 1' => 1,
48 'int 12345' => 12345,
49 'int -12345' => -2345,
51 // array data
52 'empty array' => array(),
53 'int indexed array' => $index_array,
54 'associative array' => $assoc_array,
55 'nested arrays' => array('foo', $index_array, $assoc_array),
57 // null data
58 'uppercase NULL' => NULL,
59 'lowercase null' => null,
61 // boolean data
62 'lowercase true' => true,
63 'lowercase false' =>false,
64 'uppercase TRUE' =>TRUE,
65 'uppercase FALSE' =>FALSE,
67 // empty data
68 'empty string DQ' => "",
69 'empty string SQ' => '',
71 // string data
72 'string DQ' => "string",
73 'string SQ' => 'string',
74 'mixed case string' => "sTrInG",
75 'heredoc' => $heredoc,
77 // object data
78 'instance of classWithToString' => new classWithToString(),
79 'instance of classWithoutToString' => new classWithoutToString(),
81 // undefined data
82 'undefined var' => @$undefined_var,
84 // unset data
85 'unset var' => @$unset_var,
88 // loop through each element of the array for gmt_offset
90 foreach($inputs as $key =>$value) {
91 echo "\n--$key--\n";
92 var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) );
93 var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) );
94 var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) );
98 ===DONE===