import random crap zend files
[hiphop-php.git] / hphp / test / zend / bad / ext-date / date_sunrise_variation4.php
blobc32dee07b67019b8d6b171c8c17641e000917e39
1 <?php
2 /* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
3 * Description: Returns time of sunrise for a given day and location
4 * Source code: ext/date/php_date.c
5 * Alias to functions:
6 */
8 echo "*** Testing date_sunrise() : usage variation ***\n";
10 //Initialise the variables
11 date_default_timezone_set("Asia/Calcutta");
12 $time = mktime(8, 8, 8, 8, 8, 2008);
13 $latitude = 38.4;
14 $zenith = 90;
15 $gmt_offset = 0;
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' => -12345,
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 longitude
90 foreach($inputs as $key =>$value) {
91 echo "\n--$key--\n";
92 var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) );
93 var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) );
94 var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) );
98 ===DONE===