3v4l.org

run code in 300+ PHP versions simultaneously
<?php function solstice() { // Set timezone date_default_timezone_set('UTC'); $date='2014/01/01'; $end_date='2014/12/31'; $i = 0; //loop through the year while(strtotime($date)<=strtotime($end_date)) { $sunrise=date_sunrise(strtotime($date),SUNFUNCS_RET_DOUBLE,31.47,35.13,90,3); $sunset=date_sunset(strtotime($date),SUNFUNCS_RET_DOUBLE,31.47,35.13,90,3); //calculate time difference $delta = $sunset-$sunrise; //store the time difference $delta_array[$i] = $delta; //store the date $dates_array[$i] = $date; $i++; //next day $date=date("Y-m-d",strtotime("+1 day",strtotime($date))); } $shortest_key = array_search(min($delta_array), $delta_array); $longest_key = array_search(max($delta_array), $delta_array); echo "The longest day is:".$dates_array[$longest_key]. "<br />"; echo "The shortest day is:".$dates_array[$shortest_key]. "<br />"; }
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.68 ms | 401 KiB | 8 Q