3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php header('Content-Type: text/html; charset=UTF-8'); function traffic($startlat, $startlon, $endlat, $endlon) { GLOBAL $traffic; $traffic=file_get_contents('https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A'.$startlon.'+y%3A'.$startlat.'&to=x%3A'.$endlon.'+y%3A'.$endlat.'&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0'); $traffic=json_decode($traffic,true); $tijd=0;$lengte=0; foreach($traffic['response']['results'] as $street) { $tijd = $tijd + $street['crossTime']; $lengte = $lengte + $street['length']; } $tijd = strftime("%M:%S",$tijd); $lengte = round($lengte / 1000,0); return array('tijd' => $tijd, 'lengte' => $lengte); } // $hw = traffic(50.892565,3.114135,50.877122,4.164326); // echo 'Home - Work = '.$hw['tijd'].' / '.$hw['lengte'].'km<br>'; // $wh = traffic(50.877122,4.164326,50.892565,3.114135); // echo 'Work - Home = '.$wh['tijd'].' / '.$wh['lengte'].'km<br>'; $hw = traffic(32.223122,34.993726,32.061679,34.793838); echo 'kokav - Work = '.$hw['tijd'].' / '.$hw['lengte'].'km<br>'; $hw = traffic(32.293122,34.993726,32.061679,34.793838); echo 'kokav2 - Work time MM:SS= '.$hw['tijd'].' / '.$hw['lengte'].'km<br>';
Output for 5.4.15 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.223122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav - Work = 00:00 / 0km<br> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.293122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav2 - Work time MM:SS= 00:00 / 0km<br>
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.223122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav - Work = 00:00 / 0km<br> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.293122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav2 - Work time MM:SS= 00:00 / 0km<br>
Output for 5.3.18 - 5.4.14
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.223122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: No such file or directory in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav - Work = 00:00 / 0km<br> Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/4sK5o on line 6 Warning: file_get_contents(https://www.waze.com/il-RoutingManager/routingRequest?from=x%3A34.993726+y%3A32.293122&to=x%3A34.793838+y%3A32.061679&at=0&returnJSON=true&timeout=60000&nPaths=1&clientVersion=4.0.0): failed to open stream: No such file or directory in /in/4sK5o on line 6 Warning: Invalid argument supplied for foreach() in /in/4sK5o on line 10 kokav2 - Work time MM:SS= 00:00 / 0km<br>