3v4l.org

run code in 300+ PHP versions simultaneously
<?php $location = "NewYork"; $return_arr = array(); $json = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address='. $location .'&key=AIzaSyCdKLDXk7VD2GUyLLWOhv-WjQGtvzx2LCg'); $obj = json_decode($json, true); $lat = $obj['results'][0]['geometry']['location']['lat']; $lng = $obj['results'][0]['geometry']['location']['lng']; $sql = "SELECT *, ( 3959 * acos ( cos ( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin ( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM Events HAVING distance < 30 ORDER BY distance"; $fetch = mysqli_query($conn, $sql); while ($row = mysqli_fetch_array($fetch, MYSQLI_ASSOC)) { $row_array['title'] = $row['title']; $row_array['description'] = $row['description']; $row_array['start'] = $row['start']; $row_array['end'] = $row['end']; $row_array['website'] = $row['website']; $row_array['logo_url'] = $row['logo_url']; $row_array['online_event'] = $row['online_event']; $row_array['url'] = $row['url']; $row_array['venue'] = $row['venue']; array_push($return_arr,$row_array); } echo json_encode($return_arr); mysqli_close($conn);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 39
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 39
Branch analysis from position: 77
Branch analysis from position: 39
filename:       /in/MoiDj
function name:  (null)
number of ops:  85
compiled vars:  !0 = $location, !1 = $return_arr, !2 = $json, !3 = $obj, !4 = $lat, !5 = $lng, !6 = $sql, !7 = $fetch, !8 = $conn, !9 = $row_array, !10 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'NewYork'
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'file_get_contents'
          3        CONCAT                                           ~13     'https%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fgeocode%2Fjson%3Faddress%3D', !0
          4        CONCAT                                           ~14     ~13, '%26key%3DAIzaSyCdKLDXk7VD2GUyLLWOhv-WjQGtvzx2LCg'
          5        SEND_VAL                                                 ~14
          6        DO_ICALL                                         $15     
          7        ASSIGN                                                   !2, $15
    7     8        INIT_FCALL                                               'json_decode'
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $17     
         12        ASSIGN                                                   !3, $17
    8    13        FETCH_DIM_R                                      ~19     !3, 'results'
         14        FETCH_DIM_R                                      ~20     ~19, 0
         15        FETCH_DIM_R                                      ~21     ~20, 'geometry'
         16        FETCH_DIM_R                                      ~22     ~21, 'location'
         17        FETCH_DIM_R                                      ~23     ~22, 'lat'
         18        ASSIGN                                                   !4, ~23
    9    19        FETCH_DIM_R                                      ~25     !3, 'results'
         20        FETCH_DIM_R                                      ~26     ~25, 0
         21        FETCH_DIM_R                                      ~27     ~26, 'geometry'
         22        FETCH_DIM_R                                      ~28     ~27, 'location'
         23        FETCH_DIM_R                                      ~29     ~28, 'lng'
         24        ASSIGN                                                   !5, ~29
   11    25        ROPE_INIT                                     7  ~32     'SELECT+%0A%09%09%2A%2C+%28%0A%09%09%093959+%2A+acos+%28%0A++%09%09%09cos+%28+radians%28'
   14    26        ROPE_ADD                                      1  ~32     ~32, !4
         27        ROPE_ADD                                      2  ~32     ~32, '%29+%29%0A++%09%09%09%2A+cos%28+radians%28+latitude+%29+%29%0A++%09%09%09%2A+cos%28+radians%28+longitude+%29+-+radians%28'
   16    28        ROPE_ADD                                      3  ~32     ~32, !5
         29        ROPE_ADD                                      4  ~32     ~32, '%29+%29%0A++%09%09%09%2B+sin+%28+radians%28'
   17    30        ROPE_ADD                                      5  ~32     ~32, !4
         31        ROPE_END                                      6  ~31     ~32, '%29+%29%0A++%09%09%09%2A+sin%28+radians%28+latitude+%29+%29%0A%09%09%29%0A%09%09%29+AS+distance%0A%09FROM+Events%0A%09HAVING+distance+%3C+30%0A%09ORDER+BY+distance'
   11    32        ASSIGN                                                   !6, ~31
   25    33        INIT_FCALL_BY_NAME                                       'mysqli_query'
         34        SEND_VAR_EX                                              !8
         35        SEND_VAR_EX                                              !6
         36        DO_FCALL                                      0  $37     
         37        ASSIGN                                                   !7, $37
   26    38      > JMP                                                      ->70
   27    39    >   FETCH_DIM_R                                      ~40     !10, 'title'
         40        ASSIGN_DIM                                               !9, 'title'
         41        OP_DATA                                                  ~40
   28    42        FETCH_DIM_R                                      ~42     !10, 'description'
         43        ASSIGN_DIM                                               !9, 'description'
         44        OP_DATA                                                  ~42
   29    45        FETCH_DIM_R                                      ~44     !10, 'start'
         46        ASSIGN_DIM                                               !9, 'start'
         47        OP_DATA                                                  ~44
   30    48        FETCH_DIM_R                                      ~46     !10, 'end'
         49        ASSIGN_DIM                                               !9, 'end'
         50        OP_DATA                                                  ~46
   31    51        FETCH_DIM_R                                      ~48     !10, 'website'
         52        ASSIGN_DIM                                               !9, 'website'
         53        OP_DATA                                                  ~48
   32    54        FETCH_DIM_R                                      ~50     !10, 'logo_url'
         55        ASSIGN_DIM                                               !9, 'logo_url'
         56        OP_DATA                                                  ~50
   33    57        FETCH_DIM_R                                      ~52     !10, 'online_event'
         58        ASSIGN_DIM                                               !9, 'online_event'
         59        OP_DATA                                                  ~52
   34    60        FETCH_DIM_R                                      ~54     !10, 'url'
         61        ASSIGN_DIM                                               !9, 'url'
         62        OP_DATA                                                  ~54
   35    63        FETCH_DIM_R                                      ~56     !10, 'venue'
         64        ASSIGN_DIM                                               !9, 'venue'
         65        OP_DATA                                                  ~56
   36    66        INIT_FCALL                                               'array_push'
         67        SEND_REF                                                 !1
         68        SEND_VAR                                                 !9
         69        DO_ICALL                                                 
   26    70    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         71        SEND_VAR_EX                                              !7
         72        FETCH_CONSTANT                                   ~58     'MYSQLI_ASSOC'
         73        SEND_VAL_EX                                              ~58
         74        DO_FCALL                                      0  $59     
         75        ASSIGN                                           ~60     !10, $59
         76      > JMPNZ                                                    ~60, ->39
   38    77    >   INIT_FCALL                                               'json_encode'
         78        SEND_VAR                                                 !1
         79        DO_ICALL                                         $61     
         80        ECHO                                                     $61
   40    81        INIT_FCALL_BY_NAME                                       'mysqli_close'
         82        SEND_VAR_EX                                              !8
         83        DO_FCALL                                      0          
         84      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.54 ms | 1404 KiB | 21 Q