3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GetIP() { if ($_SERVER["HTTP_X_FORWARDED_FOR"]) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if ($_SERVER["HTTP_CLIENT_IP"]) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if ($_SERVER["REMOTE_ADDR"]) $ip = $_SERVER["REMOTE_ADDR"]; else if (getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknown"; return $ip; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T0FAi
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E > > RETURN                                                   1

Function getip:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 39
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T0FAi
function name:  GetIP
number of ops:  51
compiled vars:  !0 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_R                      global              ~1      '_SERVER'
          1        FETCH_DIM_R                                      ~2      ~1, 'HTTP_X_FORWARDED_FOR'
          2      > JMPZ                                                     ~2, ->7
    6     3    >   FETCH_R                      global              ~3      '_SERVER'
          4        FETCH_DIM_R                                      ~4      ~3, 'HTTP_X_FORWARDED_FOR'
          5        ASSIGN                                                   !0, ~4
          6      > JMP                                                      ->49
    8     7    >   FETCH_R                      global              ~6      '_SERVER'
          8        FETCH_DIM_R                                      ~7      ~6, 'HTTP_CLIENT_IP'
          9      > JMPZ                                                     ~7, ->14
   10    10    >   FETCH_R                      global              ~8      '_SERVER'
         11        FETCH_DIM_R                                      ~9      ~8, 'HTTP_CLIENT_IP'
         12        ASSIGN                                                   !0, ~9
         13      > JMP                                                      ->49
   12    14    >   FETCH_R                      global              ~11     '_SERVER'
         15        FETCH_DIM_R                                      ~12     ~11, 'REMOTE_ADDR'
         16      > JMPZ                                                     ~12, ->21
   14    17    >   FETCH_R                      global              ~13     '_SERVER'
         18        FETCH_DIM_R                                      ~14     ~13, 'REMOTE_ADDR'
         19        ASSIGN                                                   !0, ~14
         20      > JMP                                                      ->49
   16    21    >   INIT_FCALL                                               'getenv'
         22        SEND_VAL                                                 'HTTP_X_FORWARDED_FOR'
         23        DO_ICALL                                         $16     
         24      > JMPZ                                                     $16, ->30
   18    25    >   INIT_FCALL                                               'getenv'
         26        SEND_VAL                                                 'HTTP_X_FORWARDED_FOR'
         27        DO_ICALL                                         $17     
         28        ASSIGN                                                   !0, $17
         29      > JMP                                                      ->49
   20    30    >   INIT_FCALL                                               'getenv'
         31        SEND_VAL                                                 'HTTP_CLIENT_IP'
         32        DO_ICALL                                         $19     
         33      > JMPZ                                                     $19, ->39
   21    34    >   INIT_FCALL                                               'getenv'
         35        SEND_VAL                                                 'HTTP_CLIENT_IP'
         36        DO_ICALL                                         $20     
         37        ASSIGN                                                   !0, $20
         38      > JMP                                                      ->49
   23    39    >   INIT_FCALL                                               'getenv'
         40        SEND_VAL                                                 'REMOTE_ADDR'
         41        DO_ICALL                                         $22     
         42      > JMPZ                                                     $22, ->48
   25    43    >   INIT_FCALL                                               'getenv'
         44        SEND_VAL                                                 'REMOTE_ADDR'
         45        DO_ICALL                                         $23     
         46        ASSIGN                                                   !0, $23
         47      > JMP                                                      ->49
   29    48    >   ASSIGN                                                   !0, 'Unknown'
   31    49    > > RETURN                                                   !0
   33    50*     > RETURN                                                   null

End of function getip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.56 ms | 1400 KiB | 15 Q