3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $station = "KORD";// Enter your airport's code here. $metarwx = "http://weather.noaa.gov/pub/data/observations/metar/stations/$station.TXT"; $metars = file_get_contents($metarwx); $metar = getCloud($metars); echo $metar; function getCloud($wxReport) { $clouds = ['BKN', 'CAVOK', 'CLR', 'FEW', 'NSC', 'OVC', 'SCT', 'SKC', 'VV']; $wxReportArray = explode(' ', $wxReport); foreach($wxReportArray as $rptPart){ $rptPart = preg_replace('/[0-9]+/', '', $rptPart); if(in_array($rptPart, $clouds)){ return $rptPart; } } }
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/nuJD7 on line 4 Warning: file_get_contents(http://weather.noaa.gov/pub/data/observations/metar/stations/KORD.TXT): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/nuJD7 on line 4
Output for hhvm-3.10.0 - 3.13.2
Warning: Failed to open http://weather.noaa.gov/pub/data/observations/metar/stations/KORD.TXT (Could not resolve host: weather.noaa.gov) in /in/nuJD7 on line 4
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/nuJD7 on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/nuJD7 on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/nuJD7 on line 10
Process exited with code 255.