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; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4rdL
function name:  (null)
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'obterCoordenadas'
          1        SEND_VAL_EX                                              '80630-000'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
    5     4        ECHO                                                     !0
   24     5      > RETURN                                                   1

Function obtercoordenadas:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 42
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4rdL
function name:  obterCoordenadas
number of ops:  44
compiled vars:  !0 = $cep, !1 = $url, !2 = $ch, !3 = $response, !4 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        CONCAT                                           ~5      'https%3A%2F%2Fnominatim.openstreetmap.org%2Fsearch%3Fformat%3Djson%26q%3D', !0
          2        ASSIGN                                                   !1, ~5
   10     3        INIT_FCALL_BY_NAME                                       'curl_init'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !2, $7
   11     7        INIT_FCALL_BY_NAME                                       'curl_setopt'
          8        SEND_VAR_EX                                              !2
          9        FETCH_CONSTANT                                   ~9      'CURLOPT_RETURNTRANSFER'
         10        SEND_VAL_EX                                              ~9
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   12    13        INIT_FCALL_BY_NAME                                       'curl_setopt'
         14        SEND_VAR_EX                                              !2
         15        FETCH_CONSTANT                                   ~11     'CURLOPT_REFERER'
         16        SEND_VAL_EX                                              ~11
         17        SEND_VAL_EX                                              'https%3A%2F%2Fcatalogodigital.webcontrolempresas.com.br'
         18        DO_FCALL                                      0          
   14    19        INIT_FCALL_BY_NAME                                       'curl_exec'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0  $13     
         22        ASSIGN                                                   !3, $13
   15    23        INIT_FCALL_BY_NAME                                       'curl_close'
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0          
   17    26        INIT_FCALL                                               'json_decode'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !4, $16
   18    31        ISSET_ISEMPTY_CV                                 ~18     !4
         32        BOOL_NOT                                         ~19     ~18
         33      > JMPZ                                                     ~19, ->42
   19    34    >   FETCH_DIM_R                                      ~20     !4, 0
         35        FETCH_DIM_R                                      ~21     ~20, 'lon'
         36        INIT_ARRAY                                       ~22     ~21
         37        FETCH_DIM_R                                      ~23     !4, 0
         38        FETCH_DIM_R                                      ~24     ~23, 'lat'
         39        ADD_ARRAY_ELEMENT                                ~22     ~24
         40      > RETURN                                                   ~22
   18    41*       JMP                                                      ->43
   21    42    > > RETURN                                                   <false>
   23    43*     > RETURN                                                   null

End of function obtercoordenadas

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.21 ms | 1431 KiB | 14 Q