1--TEST-- 2Test date_sunrise() function : usage variation - Checking with North and South poles when Sun is up and down all day 3--FILE-- 4<?php 5/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) 6 * Description: Returns time of sunrise for a given day and location 7 * Source code: ext/date/php_date.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing date_sunrise() : usage variation ***\n"; 12 13// GMT is zero for the timezone 14date_default_timezone_set("Africa/Casablanca"); 15$time_date = array ( 16 17 //Date at which Sun is up all day at North Pole 18 "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), 19 "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), 20 21 //Date at which Sun is up all day at South Pole 22 "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), 23 "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), 24); 25 26//Iterate over different date and time 27foreach( $time_date as $date => $time ){ 28 echo "\n--$date--\n"; 29 var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) ); 30 var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); 31 var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); 32 var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) ); 33 var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); 34 var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); 35} 36 37?> 38===DONE=== 39--EXPECT-- 40*** Testing date_sunrise() : usage variation *** 41 42--12 Aug 2008-- 43bool(false) 44bool(false) 45bool(false) 46bool(false) 47bool(false) 48bool(false) 49 50--13 Aug 2008-- 51bool(false) 52bool(false) 53bool(false) 54bool(false) 55bool(false) 56bool(false) 57 58--12 Nov 2008-- 59bool(false) 60bool(false) 61bool(false) 62bool(false) 63bool(false) 64bool(false) 65 66--13 Nov 2008-- 67bool(false) 68bool(false) 69bool(false) 70bool(false) 71bool(false) 72bool(false) 73===DONE=== 74