3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Europe/Berlin'); function getsuntimes($sunrisemin,$sunsetmin){ $result = file_get_contents('http://weather.yahooapis.com/forecastrss?w=12835286&u=c'); $xml = simplexml_load_string($result); $xml->registerXPathNamespace('yweather', 'http://xml.weather.yahoo.com/ns/rss/1.0'); $astronomy = $xml->channel->xpath('yweather:astronomy'); $sunrise = $astronomy[0]['sunrise']; $sunset = $astronomy[0]['sunset']; $sunrise = date("G:i", strtotime($sunrise)); $sunset = date("G:i", strtotime($sunset)); $dt = DateTime::createFromFormat('H:i', $sunrise); if ($sunrisemin > 0) { $dt->add(new DateInterval('PT'.$sunrisemin.'M')); } else { $sunrisemin = str_replace('-','',$sunrisemin); $dt->sub(new DateInterval('PT'.$sunrisemin.'M')); } $sunrisemod = $dt->format('H:i'); $dt = DateTime::createFromFormat('H:i', $sunset); if ($sunsetmin > 0) { $dt->add(new DateInterval('PT'.$sunsetmin.'M')); } else { $sunsetmin = str_replace('-','',$sunsetmin); $dt->sub(new DateInterval('PT'.$sunsetmin.'M')); } $sunsetmod = $dt->format('H:i'); $output['sunrise'] = $sunrisemod; $output['sunset'] = $sunsetmod; return $output; } ?>
Output for 5.1.0 - 7.2.0
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/TA9jI on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/TA9jI on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/TA9jI on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/TA9jI on line 2