3v4l.org

run code in 150+ 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 5.3.2 - 5.4.38, 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.1.0
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Name or service not known 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: Name or service not known 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 5.4.39 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4
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 5.2.12 - 5.2.17
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Name or service not known 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: Name or service not known 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