3v4l.org

run code in 300+ PHP versions simultaneously
<?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
Output for 8.0.0 - 8.0.10, 8.1rc1 - rc2
on 2018-03-14 sun rises at 06:14:23 and sets at 18:04:01
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.23
on 2018-03-14 sun rises at 06:15:59 and sets at 18:02:24
Output for 7.1.25 - 7.1.33
on 2018-03-14 sun rises at 06:14:51 and sets at 18:03:16

preferences:
63.93 ms | 461 KiB | 5 Q