3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', 'On'); $json_string = file_get_contents("http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json"); $parsed_json = json_decode($json_string); $location = $parsed_json->{'location'}->{'city'}; $temp_c = floatval($parsed_json->{'current_observation'}->{'temp_c'}); $weather = $parsed_json->{'current_observation'}->{'weather'}; $feelslike_c = $parsed_json->{'current_observation'}->{'feelslike_c'}; $wind_kph = floatval($parsed_json->{'current_observation'}->{'wind_kph'}); if(1 == $temp_c) { $stopnieSlownie = "stopień"; } elseif( ($temp_c >= 2) && ($temp_c <= 4) ) { $stopnieSlownie = "stopnie"; } else { $stopnieSlownie = "stopni"; } if(1 == $wind_kph) { $kilometrySlownie = "kilometr"; } elseif( ($wind_kph >= 2) && ($wind_kph <= 4) ) { $kilometrySlownie = "kilometry"; } else { $kilometrySlownie = "kilometrów"; } var_dump($temp_c); echo "To jest prognoza dla miejscowości ${location}:<br/>"; echo "Temperatura to " . round($temp_c) . " ${stopnieSlownie}, odczuwalne " . round($feelslike_c) . " ${stopnieSlownie}, jest ${weather} <br/>"; echo "Wiatr wieje z prędkością " . round($wind_kph) . " ${kilometrySlownie} na godzinę.\n"; ?> </body> </html>
Output for 5.2.6 - 5.6.28, 7.0.0 - 7.1.0
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Notice: Trying to get property of non-object in /in/DnM44 on line 13 Notice: Trying to get property of non-object in /in/DnM44 on line 13 Notice: Trying to get property of non-object in /in/DnM44 on line 14 Notice: Trying to get property of non-object in /in/DnM44 on line 14 Notice: Trying to get property of non-object in /in/DnM44 on line 15 Notice: Trying to get property of non-object in /in/DnM44 on line 15 Notice: Trying to get property of non-object in /in/DnM44 on line 16 Notice: Trying to get property of non-object in /in/DnM44 on line 16 Notice: Trying to get property of non-object in /in/DnM44 on line 17 Notice: Trying to get property of non-object in /in/DnM44 on line 17 float(0) To jest prognoza dla miejscowości :<br/>Temperatura to 0 stopni, odczuwalne 0 stopni, jest <br/>Wiatr wieje z prędkością 0 kilometrów na godzinę. </body> </html>
Output for hhvm-3.10.0 - 3.12.0
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: Failed to open http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json (Could not resolve host: api.wunderground.com) in /in/DnM44 on line 11 Notice: Cannot access property on non-object in /in/DnM44 on line 13 Notice: Cannot access property on non-object in /in/DnM44 on line 13 Notice: Cannot access property on non-object in /in/DnM44 on line 14 Notice: Cannot access property on non-object in /in/DnM44 on line 14 Notice: Cannot access property on non-object in /in/DnM44 on line 15 Notice: Cannot access property on non-object in /in/DnM44 on line 15 Notice: Cannot access property on non-object in /in/DnM44 on line 16 Notice: Cannot access property on non-object in /in/DnM44 on line 16 Notice: Cannot access property on non-object in /in/DnM44 on line 17 Notice: Cannot access property on non-object in /in/DnM44 on line 17 float(0) To jest prognoza dla miejscowości :<br/>Temperatura to 0 stopni, odczuwalne 0 stopni, jest <br/>Wiatr wieje z prędkością 0 kilometrów na godzinę. </body> </html>
Output for 5.2.0 - 5.2.5
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Connection refused in /in/DnM44 on line 11 Notice: Trying to get property of non-object in /in/DnM44 on line 13 Notice: Trying to get property of non-object in /in/DnM44 on line 13 Notice: Trying to get property of non-object in /in/DnM44 on line 14 Notice: Trying to get property of non-object in /in/DnM44 on line 14 Notice: Trying to get property of non-object in /in/DnM44 on line 15 Notice: Trying to get property of non-object in /in/DnM44 on line 15 Notice: Trying to get property of non-object in /in/DnM44 on line 16 Notice: Trying to get property of non-object in /in/DnM44 on line 16 Notice: Trying to get property of non-object in /in/DnM44 on line 17 Notice: Trying to get property of non-object in /in/DnM44 on line 17 float(0) To jest prognoza dla miejscowości :<br/>Temperatura to 0 stopni, odczuwalne 0 stopni, jest <br/>Wiatr wieje z prędkością 0 kilometrów na godzinę. </body> </html>
Output for 5.0.3 - 5.1.6
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Connection refused in /in/DnM44 on line 11 Fatal error: Call to undefined function json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 5.0.1 - 5.0.2
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Success in /in/DnM44 on line 11 Fatal error: Call to undefined function json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 5.0.0
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Bad file descriptor in /in/DnM44 on line 11 Fatal error: Call to undefined function json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Connection refused in /in/DnM44 on line 11 Fatal error: Call to undefined function: json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 4.3.3 - 4.3.4, 4.3.10 - 4.4.4
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Connection refused in /in/DnM44 on line 11 Fatal error: Call to undefined function: json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 4.3.5 - 4.3.9
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Success in /in/DnM44 on line 11 Fatal error: Call to undefined function: json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 4.3.2
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /in/DnM44 on line 11 Warning: file_get_contents(http://api.wunderground.com/api/b6a5485aadd03b5f/geolookup/conditions/lang:PL/q/Poland/Opole.json): failed to open stream: Connection refused in /in/DnM44 on line 11 Fatal error: Call to undefined function: json_decode() in /in/DnM44 on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body>