3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED'); else if(getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR'); else if(getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED'); else if(getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR'); else $ipaddress = 'UNKNOWN'; return $ipaddress; } echo get_client_ip(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MkPcQ
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'get_client_ip'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   21     3      > RETURN                                                   1

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

End of function get_client_ip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.09 ms | 1402 KiB | 16 Q