3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function apiCall($url) { $data = null; // New prices uploaded if (get_transient("newPricesUploaded")) { // Get all cached API urls and delete them if (false !== ($transients = get_transient("apiCallTransients")) { foreach ($transients as $transient) { delete_transient($transient); } delete_transient("apiCallTransients"); } // Reset set_transient("newPricesUploaded", 0, YEAR_IN_SECONDS); } if (false === ($data = get_transient(md5($url)))) { $data = file_get_contents($url); // Cache the request set_transient(md5($url), $data, 10800); // Update the apiCallTransients reference if (false !== ($transients = get_transient("apiCallTransients")) { $transients[] = md5($url); } else { $transients = array(md5($url)); } set_transient("apiCallTransients", $transients, YEAR_IN_SECONDS); } return $data; }
Output for 5.3.0 - 5.4.21
Parse error: syntax error, unexpected '{' in /in/7VX1D on line 10
Process exited with code 255.