3v4l.org

run code in 300+ PHP versions simultaneously
<?php function visitor_country() { $ip = $_SERVER["REMOTE_ADDR"]; if(filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if(filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; $result = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)) ->geoplugin_countryName; return $result <> NULL ? $result : "Unknown"; } echo visitor_country(); // Output Coutry name [Ex: United States] ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p9glH
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'visitor_country'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   16     3      > RETURN                                                   1

Function visitor_country:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 15
filename:       /in/p9glH
function name:  visitor_country
number of ops:  45
compiled vars:  !0 = $ip, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_R                      global              ~2      '_SERVER'
          1        FETCH_DIM_R                                      ~3      ~2, 'REMOTE_ADDR'
          2        ASSIGN                                                   !0, ~3
    5     3        INIT_FCALL                                               'filter_var'
          4        BEGIN_SILENCE                                    ~5      
          5        FETCH_R                      global              ~6      '_SERVER'
          6        FETCH_DIM_R                                      ~7      ~6, 'HTTP_X_FORWARDED_FOR'
          7        END_SILENCE                                              ~5
          8        SEND_VAL                                                 ~7
          9        SEND_VAL                                                 275
         10        DO_ICALL                                         $8      
         11      > JMPZ                                                     $8, ->15
    6    12    >   FETCH_R                      global              ~9      '_SERVER'
         13        FETCH_DIM_R                                      ~10     ~9, 'HTTP_X_FORWARDED_FOR'
         14        ASSIGN                                                   !0, ~10
    7    15    >   INIT_FCALL                                               'filter_var'
         16        BEGIN_SILENCE                                    ~12     
         17        FETCH_R                      global              ~13     '_SERVER'
         18        FETCH_DIM_R                                      ~14     ~13, 'HTTP_CLIENT_IP'
         19        END_SILENCE                                              ~12
         20        SEND_VAL                                                 ~14
         21        SEND_VAL                                                 275
         22        DO_ICALL                                         $15     
         23      > JMPZ                                                     $15, ->27
    8    24    >   FETCH_R                      global              ~16     '_SERVER'
         25        FETCH_DIM_R                                      ~17     ~16, 'HTTP_CLIENT_IP'
         26        ASSIGN                                                   !0, ~17
    9    27    >   BEGIN_SILENCE                                    ~19     
         28        INIT_FCALL                                               'json_decode'
         29        INIT_FCALL                                               'file_get_contents'
         30        CONCAT                                           ~20     'http%3A%2F%2Fwww.geoplugin.net%2Fjson.gp%3Fip%3D', !0
         31        SEND_VAL                                                 ~20
         32        DO_ICALL                                         $21     
         33        SEND_VAR                                                 $21
         34        DO_ICALL                                         $22     
   10    35        FETCH_OBJ_R                                      ~23     $22, 'geoplugin_countryName'
         36        END_SILENCE                                              ~19
    9    37        ASSIGN                                                   !1, ~23
   11    38        IS_NOT_EQUAL                                             !1, null
         39      > JMPZ                                                     ~25, ->42
         40    >   QM_ASSIGN                                        ~26     !1
         41      > JMP                                                      ->43
         42    >   QM_ASSIGN                                        ~26     'Unknown'
         43    > > RETURN                                                   ~26
   12    44*     > RETURN                                                   null

End of function visitor_country

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.85 ms | 1394 KiB | 20 Q