3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = obterCoordenadas("80630-000"); echo $x; function obterCoordenadas($cep) { $url = "https://nominatim.openstreetmap.org/search?format=json&q=" . $cep; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_REFERER, "https://catalogodigital.webcontrolempresas.com.br"); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if (!empty($data)) { return [$data[0]['lon'], $data[0]['lat']]; } else { return false; } } ?>
Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/s4rdL:10 Stack trace: #0 /in/s4rdL(3): obterCoordenadas('80630-000') #1 {main} thrown in /in/s4rdL on line 10
Process exited with code 255.

preferences:
82.31 ms | 402 KiB | 65 Q