3v4l.org

run code in 200+ php & hhvm versions
<?php function sunTimes($lat, $long, $date) { date_default_timezone_set('UTC'); $sun_info = date_sun_info(strtotime($date), $lat, $long); $sunrise = date("H:i:s", $sun_info['sunrise']); $sunset = date("H:i:s", $sun_info['sunset']); return "on $date sun rises at $sunrise and sets at $sunset"; } echo sunTimes(51.5, 0, '2018-03-14'); // ~London
based on HpsRW
Output for 7.2.0 - 7.4.0alpha2
on 2018-03-14 sun rises at 06:15:59 and sets at 18:02:24
Output for 7.1.25 - 7.1.30
on 2018-03-14 sun rises at 06:14:51 and sets at 18:03:16