3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = simplexml_load_file('http://weather.yahooapis.com/forecastrss?w=868274&u=c'); $weatherInfo = $xml->channel->item->description; $imagePattern = '/src="(.*?)"/i'; preg_match($imagePattern, $weatherInfo, $matches); $imageSrc = $matches[1]; $degreesPattern = '/.*?, (-?\d+) C/i'; preg_match($degreesPattern, $weatherInfo, $matches); $degrees = $matches[1]; echo $degrees;
Output for 7.2.0
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/qfSfE on line 2 Warning: simplexml_load_file(http://weather.yahooapis.com/forecastrss?w=868274&u=c): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/qfSfE on line 2 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://weather.yahooapis.com/forecastrss?w=868274&u=c" in /in/qfSfE on line 2 Notice: Trying to get property 'channel' of non-object in /in/qfSfE on line 3 Notice: Trying to get property 'item' of non-object in /in/qfSfE on line 3 Notice: Trying to get property 'description' of non-object in /in/qfSfE on line 3 Notice: Undefined offset: 1 in /in/qfSfE on line 6 Notice: Undefined offset: 1 in /in/qfSfE on line 9
Output for 5.3.0 - 5.6.30, 7.0.0 - 7.1.10
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: System error in /in/qfSfE on line 2 Warning: simplexml_load_file(http://weather.yahooapis.com/forecastrss?w=868274&u=c): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/qfSfE on line 2 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://weather.yahooapis.com/forecastrss?w=868274&u=c" in /in/qfSfE on line 2 Notice: Trying to get property of non-object in /in/qfSfE on line 3 Notice: Trying to get property of non-object in /in/qfSfE on line 3 Notice: Trying to get property of non-object in /in/qfSfE on line 3 Notice: Undefined offset: 1 in /in/qfSfE on line 6 Notice: Undefined offset: 1 in /in/qfSfE on line 9
Output for hhvm-3.11.1 - 3.17.3
Warning: Failed to open http://weather.yahooapis.com/forecastrss?w=868274&u=c (Could not resolve host: weather.yahooapis.com) in /in/qfSfE on line 2 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Warning: preg_match() expects parameter 2 to be string, null given in /in/qfSfE on line 5 Warning: preg_match() expects parameter 2 to be string, null given in /in/qfSfE on line 8
Output for hhvm-3.10.1
Warning: Failed to open http://weather.yahooapis.com/forecastrss?w=868274&u=c (Could not resolve host: weather.yahooapis.com) in /in/qfSfE on line 2 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Notice: Cannot access property on non-object in /in/qfSfE on line 3 Notice: Undefined index: 1 in /in/qfSfE on line 6 Notice: Undefined index: 1 in /in/qfSfE on line 9