3v4l.org

run code in 300+ PHP versions simultaneously
<?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 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:
58.91 ms | 401 KiB | 8 Q