3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<table><tr><th>Monitor Name</th><th>Status</th><th>Total Uptime</th></tr>"; $apiKey = "m776097161-b38ad92f08eaf38909272bdd"; $url = "http://api.uptimerobot.com/getMonitors?apiKey=" . $apiKey . "&format=xml"; $xml = file_get_contents($url); $xml = new SimpleXMLElement ($xml); foreach($xml->monitor as $monitor) { echo "<tr>"; echo "<td>"; echo $monitor['friendlyname']; echo "</td><td>"; if ($monitor['status'] == 2) { echo "Online"; } elseif ($monitor['status'] == 9) { echo "Offline"; } else { echo "Not Available"; } echo "</td><td>"; if ($monitor['alltimeuptimeratio'] > 95) { echo "<b style=\"color:green;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>"; } else { echo "<b style=\"color:red;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>"; } } echo "</table>"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
<table><tr><th>Monitor Name</th><th>Status</th><th>Total Uptime</th></tr> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for api.uptimerobot.com failed: System error in /in/CpYqQ on line 5 Warning: file_get_contents(http://api.uptimerobot.com/getMonitors?apiKey=m776097161-b38ad92f08eaf38909272bdd&format=xml): Failed to open stream: php_network_getaddresses: getaddrinfo for api.uptimerobot.com failed: System error in /in/CpYqQ on line 5 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/CpYqQ:6 Stack trace: #0 /in/CpYqQ(6): SimpleXMLElement->__construct('') #1 {main} thrown in /in/CpYqQ on line 6
Process exited with code 255.

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:
36.1 ms | 402 KiB | 8 Q