3v4l.org

run code in 300+ PHP versions simultaneously
<?php function clientIp() { $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 clientIp();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j3lmO
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'clientip'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function clientip:
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/j3lmO
function name:  clientIp
number of ops:  58
compiled vars:  !0 = $ipaddress
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, ''
    5     1        INIT_FCALL                                               'getenv'
          2        SEND_VAL                                                 'HTTP_CLIENT_IP'
          3        DO_ICALL                                         $2      
          4      > JMPZ                                                     $2, ->10
    6     5    >   INIT_FCALL                                               'getenv'
          6        SEND_VAL                                                 'HTTP_CLIENT_IP'
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !0, $3
          9      > JMP                                                      ->56
    7    10    >   INIT_FCALL                                               'getenv'
         11        SEND_VAL                                                 'HTTP_X_FORWARDED_FOR'
         12        DO_ICALL                                         $5      
         13      > JMPZ                                                     $5, ->19
    8    14    >   INIT_FCALL                                               'getenv'
         15        SEND_VAL                                                 'HTTP_X_FORWARDED_FOR'
         16        DO_ICALL                                         $6      
         17        ASSIGN                                                   !0, $6
         18      > JMP                                                      ->56
    9    19    >   INIT_FCALL                                               'getenv'
         20        SEND_VAL                                                 'HTTP_X_FORWARDED'
         21        DO_ICALL                                         $8      
         22      > JMPZ                                                     $8, ->28
   10    23    >   INIT_FCALL                                               'getenv'
         24        SEND_VAL                                                 'HTTP_X_FORWARDED'
         25        DO_ICALL                                         $9      
         26        ASSIGN                                                   !0, $9
         27      > JMP                                                      ->56
   11    28    >   INIT_FCALL                                               'getenv'
         29        SEND_VAL                                                 'HTTP_FORWARDED_FOR'
         30        DO_ICALL                                         $11     
         31      > JMPZ                                                     $11, ->37
   12    32    >   INIT_FCALL                                               'getenv'
         33        SEND_VAL                                                 'HTTP_FORWARDED_FOR'
         34        DO_ICALL                                         $12     
         35        ASSIGN                                                   !0, $12
         36      > JMP                                                      ->56
   13    37    >   INIT_FCALL                                               'getenv'
         38        SEND_VAL                                                 'HTTP_FORWARDED'
         39        DO_ICALL                                         $14     
         40      > JMPZ                                                     $14, ->46
   14    41    >   INIT_FCALL                                               'getenv'
         42        SEND_VAL                                                 'HTTP_FORWARDED'
         43        DO_ICALL                                         $15     
         44        ASSIGN                                                   !0, $15
         45      > JMP                                                      ->56
   15    46    >   INIT_FCALL                                               'getenv'
         47        SEND_VAL                                                 'REMOTE_ADDR'
         48        DO_ICALL                                         $17     
         49      > JMPZ                                                     $17, ->55
   16    50    >   INIT_FCALL                                               'getenv'
         51        SEND_VAL                                                 'REMOTE_ADDR'
         52        DO_ICALL                                         $18     
         53        ASSIGN                                                   !0, $18
         54      > JMP                                                      ->56
   18    55    >   ASSIGN                                                   !0, 'UNKNOWN'
   19    56    > > RETURN                                                   !0
   20    57*     > RETURN                                                   null

End of function clientip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.05 ms | 1407 KiB | 16 Q