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
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);
17 //get an unset variable
21 // define some classes
22 class classWithToString
24 public function __toString() {
25 return "Class A object";
29 class classWithoutToString
39 $index_array = array (1, 2, 3);
40 $assoc_array = array ('one' => 1, 'two' => 2);
42 //array of values to iterate over
49 'int -12345' => -2345,
52 'empty array' => array(),
53 'int indexed array' => $index_array,
54 'associative array' => $assoc_array,
55 'nested arrays' => array('foo', $index_array, $assoc_array),
58 'uppercase NULL' => NULL,
59 'lowercase null' => null,
62 'lowercase true' => true,
63 'lowercase false' =>false,
64 'uppercase TRUE' =>TRUE,
65 'uppercase FALSE' =>FALSE,
68 'empty string DQ' => "",
69 'empty string SQ' => '',
72 'string DQ' => "string",
73 'string SQ' => 'string',
74 'mixed case string' => "sTrInG",
75 'heredoc' => $heredoc,
78 'instance of classWithToString' => new classWithToString(),
79 'instance of classWithoutToString' => new classWithoutToString(),
82 'undefined var' => @$undefined_var,
85 'unset var' => @$unset_var,
88 // loop through each element of the array for longitude
90 foreach($inputs as $key =>$value) {
92 var_dump( date_sunset($time, SUNFUNCS_RET_STRING
, $latitude, $value, $zenith, $gmt_offset) );
93 var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE
, $latitude, $value, $zenith, $gmt_offset) );
94 var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP
, $latitude, $value, $zenith, $gmt_offset) );