3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get the original answer $answer = $output['answer']; // Get gold price from external API // // https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json $start_date = date('Y-m-d', strtotime('-3 days')); $json_string = file_get_contents("https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=$start_date"); $json_object = json_decode($json_string,true); $gold_price = $json_object['dataset']['data'][0]['1']; // Update the answer by filling the gap XXXX with the actual value of gold $answer = str_replace('XXXX', $gold_price , $answer); // send the answer to Alexa $output['answer'] = $answer; ?>
Output for 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined variable $output in /in/NQljQ on line 4 Warning: Trying to access array offset on null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): Failed to open stream: Operation not permitted in /in/NQljQ on line 9 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /in/NQljQ on line 14 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/NQljQ on line 14
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined variable $output in /in/NQljQ on line 4 Warning: Trying to access array offset on null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): Failed to open stream: Operation not permitted in /in/NQljQ on line 9 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Warning: Trying to access array offset on null in /in/NQljQ on line 11 Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /in/NQljQ on line 14 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/NQljQ on line 14
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined variable $output in /in/NQljQ on line 4 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): Failed to open stream: Operation not permitted in /in/NQljQ on line 9 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /in/NQljQ on line 14 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/NQljQ on line 14
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Warning: Undefined variable $output in /in/NQljQ on line 4 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): Failed to open stream: Operation not permitted in /in/NQljQ on line 9 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11
Output for 8.0.13
Warning: Undefined variable $output in /in/NQljQ on line 4 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): Failed to open stream: No such file or directory in /in/NQljQ on line 9 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11 Warning: Trying to access array offset on value of type null in /in/NQljQ on line 11
Output for 7.4.33
Notice: Undefined variable: output in /in/NQljQ on line 4 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: No such file or directory in /in/NQljQ on line 9 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11
Output for 7.4.0 - 7.4.32
Notice: Undefined variable: output in /in/NQljQ on line 4 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: Operation not permitted in /in/NQljQ on line 9 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11 Notice: Trying to access array offset on value of type null in /in/NQljQ on line 11
Output for 7.3.32 - 7.3.33
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: No such file or directory in /in/NQljQ on line 9
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31
Notice: Undefined variable: output in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in:/etc) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: Operation not permitted in /in/NQljQ on line 9
Output for 7.1.20, 7.2.6
Notice: Undefined variable: output in /in/NQljQ on line 4 Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/NQljQ on line 9 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16) is not within the allowed path(s): (/tmp:/in) in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: Operation not permitted in /in/NQljQ on line 9
Output for 7.0.20, 7.1.5 - 7.1.10, 7.2.0
Notice: Undefined variable: output in /in/NQljQ on line 4 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/NQljQ on line 9
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.10, 7.1.0
Notice: Undefined variable: output in /in/NQljQ on line 4 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/NQljQ on line 9 Warning: file_get_contents(https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=2015-12-16): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/NQljQ on line 9

preferences:
158.04 ms | 402 KiB | 255 Q