3v4l.org

run code in 300+ PHP versions simultaneously
<?php $XMLContent=file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); //the file is updated daily between 2.15 p.m. and 3.00 p.m. CET foreach($XMLContent as $line){ if(preg_match("/currency='([[:alpha:]]+)'/",$line,$currencyCode)){ if(preg_match("/rate='([[:graph:]]+)'/",$line,$rate)){ //Output the value of 1EUR for a currency code echo'1&euro;='.$rate[1].' '.$currencyCode[1].'<br/>'; //-------------------------------------------------- //Here you can add your code for inserting //$rate[1] and $currencyCode[1] into your database //-------------------------------------------------- } } } ?>
Output for 8.3.0 - 8.3.6
Warning: file(): php_network_getaddresses: getaddrinfo for www.ecb.europa.eu failed: System error in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): Failed to open stream: php_network_getaddresses: getaddrinfo for www.ecb.europa.eu failed: System error in /in/A1rvZ on line 2 Warning: foreach() argument must be of type array|object, false given in /in/A1rvZ on line 5
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: file(): php_network_getaddresses: getaddrinfo for www.ecb.europa.eu failed: System error in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): Failed to open stream: php_network_getaddresses: getaddrinfo for www.ecb.europa.eu failed: System error in /in/A1rvZ on line 2 Warning: foreach() argument must be of type array|object, bool given in /in/A1rvZ on line 5
Output for 8.0.13 - 8.0.30
Warning: file(): php_network_getaddresses: getaddrinfo failed: System error in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): Failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/A1rvZ on line 2 Warning: foreach() argument must be of type array|object, bool given in /in/A1rvZ on line 5
Output for 8.0.0 - 8.0.12
Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): Failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/A1rvZ on line 2 Warning: foreach() argument must be of type array|object, bool given in /in/A1rvZ on line 5
Output for 5.4.2 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.3.32 - 7.3.33, 7.4.0, 7.4.26 - 7.4.33
Warning: file(): php_network_getaddresses: getaddrinfo failed: System error in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/A1rvZ on line 2 Warning: Invalid argument supplied for foreach() in /in/A1rvZ on line 5
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.3 - 7.4.25
Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/A1rvZ on line 2 Warning: Invalid argument supplied for foreach() in /in/A1rvZ on line 5
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.5.35, 5.6.8 - 5.6.17, 5.6.20 - 5.6.28, 7.0.0 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/A1rvZ on line 2 Warning: file(http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/A1rvZ on line 2 Warning: Invalid argument supplied for foreach() in /in/A1rvZ on line 5

preferences:
227.95 ms | 403 KiB | 269 Q