3v4l.org

run code in 300+ PHP versions simultaneously
<?php $current_location = json_decode(file_get_contents('http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR'])); $lat2 = $current_location->latitude; $lon2 = $current_location->longitude; ?> <?php $resto_address = $row->field_address; $prepAddr = str_replace(' ','+',$resto_address); $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false'); $output2= json_decode($geocode); $lat1 = $output2->results[0]->geometry->location->lat; $lon1 = $output2->results[0]->geometry->location->lng; $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); echo $miles = $dist * 60 * 1.1515; //$unit = strtoupper(M); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WB05U
function name:  (null)
number of ops:  95
compiled vars:  !0 = $current_location, !1 = $lat2, !2 = $lon2, !3 = $resto_address, !4 = $row, !5 = $prepAddr, !6 = $geocode, !7 = $output2, !8 = $lat1, !9 = $lon1, !10 = $theta, !11 = $dist, !12 = $miles
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   INIT_FCALL                                               'json_decode'
          1        INIT_FCALL                                               'file_get_contents'
          2        FETCH_R                      global              ~13     '_SERVER'
          3        FETCH_DIM_R                                      ~14     ~13, 'REMOTE_ADDR'
          4        CONCAT                                           ~15     'http%3A%2F%2Ffreegeoip.net%2Fjson%2F', ~14
          5        SEND_VAL                                                 ~15
          6        DO_ICALL                                         $16     
          7        SEND_VAR                                                 $16
          8        DO_ICALL                                         $17     
          9        ASSIGN                                                   !0, $17
    3    10        FETCH_OBJ_R                                      ~19     !0, 'latitude'
         11        ASSIGN                                                   !1, ~19
    4    12        FETCH_OBJ_R                                      ~21     !0, 'longitude'
         13        ASSIGN                                                   !2, ~21
    5    14        ECHO                                                     '%0A'
    7    15        FETCH_OBJ_R                                      ~23     !4, 'field_address'
         16        ASSIGN                                                   !3, ~23
    8    17        INIT_FCALL                                               'str_replace'
         18        SEND_VAL                                                 '+'
         19        SEND_VAL                                                 '%2B'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $25     
         22        ASSIGN                                                   !5, $25
    9    23        INIT_FCALL                                               'file_get_contents'
         24        CONCAT                                           ~27     'http%3A%2F%2Fmaps.google.com%2Fmaps%2Fapi%2Fgeocode%2Fjson%3Faddress%3D', !5
         25        CONCAT                                           ~28     ~27, '%26sensor%3Dfalse'
         26        SEND_VAL                                                 ~28
         27        DO_ICALL                                         $29     
         28        ASSIGN                                                   !6, $29
   10    29        INIT_FCALL                                               'json_decode'
         30        SEND_VAR                                                 !6
         31        DO_ICALL                                         $31     
         32        ASSIGN                                                   !7, $31
   11    33        FETCH_OBJ_R                                      ~33     !7, 'results'
         34        FETCH_DIM_R                                      ~34     ~33, 0
         35        FETCH_OBJ_R                                      ~35     ~34, 'geometry'
         36        FETCH_OBJ_R                                      ~36     ~35, 'location'
         37        FETCH_OBJ_R                                      ~37     ~36, 'lat'
         38        ASSIGN                                                   !8, ~37
   12    39        FETCH_OBJ_R                                      ~39     !7, 'results'
         40        FETCH_DIM_R                                      ~40     ~39, 0
         41        FETCH_OBJ_R                                      ~41     ~40, 'geometry'
         42        FETCH_OBJ_R                                      ~42     ~41, 'location'
         43        FETCH_OBJ_R                                      ~43     ~42, 'lng'
         44        ASSIGN                                                   !9, ~43
   14    45        SUB                                              ~45     !9, !2
         46        ASSIGN                                                   !10, ~45
   15    47        INIT_FCALL                                               'sin'
         48        INIT_FCALL                                               'deg2rad'
         49        SEND_VAR                                                 !8
         50        DO_ICALL                                         $47     
         51        SEND_VAR                                                 $47
         52        DO_ICALL                                         $48     
         53        INIT_FCALL                                               'sin'
         54        INIT_FCALL                                               'deg2rad'
         55        SEND_VAR                                                 !1
         56        DO_ICALL                                         $49     
         57        SEND_VAR                                                 $49
         58        DO_ICALL                                         $50     
         59        MUL                                              ~51     $48, $50
         60        INIT_FCALL                                               'cos'
         61        INIT_FCALL                                               'deg2rad'
         62        SEND_VAR                                                 !8
         63        DO_ICALL                                         $52     
         64        SEND_VAR                                                 $52
         65        DO_ICALL                                         $53     
         66        INIT_FCALL                                               'cos'
         67        INIT_FCALL                                               'deg2rad'
         68        SEND_VAR                                                 !1
         69        DO_ICALL                                         $54     
         70        SEND_VAR                                                 $54
         71        DO_ICALL                                         $55     
         72        MUL                                              ~56     $53, $55
         73        INIT_FCALL                                               'cos'
         74        INIT_FCALL                                               'deg2rad'
         75        SEND_VAR                                                 !10
         76        DO_ICALL                                         $57     
         77        SEND_VAR                                                 $57
         78        DO_ICALL                                         $58     
         79        MUL                                              ~59     $58, ~56
         80        ADD                                              ~60     ~51, ~59
         81        ASSIGN                                                   !11, ~60
   16    82        INIT_FCALL                                               'acos'
         83        SEND_VAR                                                 !11
         84        DO_ICALL                                         $62     
         85        ASSIGN                                                   !11, $62
   17    86        INIT_FCALL                                               'rad2deg'
         87        SEND_VAR                                                 !11
         88        DO_ICALL                                         $64     
         89        ASSIGN                                                   !11, $64
   18    90        MUL                                              ~66     !11, 60
         91        MUL                                              ~67     ~66, 1.1515
         92        ASSIGN                                           ~68     !12, ~67
         93        ECHO                                                     ~68
   23    94      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.71 ms | 1404 KiB | 29 Q