3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getUserIP() { $ipas = null; $keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); foreach($keys as $key) { $value = isset($_SERVER[$key]) ? $_SERVER[$key] : null; if(isset($value)) { foreach(explode(',', $value) as $ip) { if(false !== filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { $ipas = $ip; } } } } return $ipas; } echo getUserIp();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lPEPg
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'getuserip'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function getuserip:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 32
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 32
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 30
Branch analysis from position: 31
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/lPEPg
function name:  getUserIP
number of ops:  35
compiled vars:  !0 = $ipas, !1 = $keys, !2 = $key, !3 = $value, !4 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, null
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $7      !1, ->32
          3    > > FE_FETCH_R                                               $7, !2, ->32
    6     4    >   FETCH_IS                                         ~8      '_SERVER'
          5        ISSET_ISEMPTY_DIM_OBJ                         0          ~8, !2
          6      > JMPZ                                                     ~9, ->11
          7    >   FETCH_R                      global              ~10     '_SERVER'
          8        FETCH_DIM_R                                      ~11     ~10, !2
          9        QM_ASSIGN                                        ~12     ~11
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~12     null
         12    >   ASSIGN                                                   !3, ~12
    7    13        ISSET_ISEMPTY_CV                                         !3
         14      > JMPZ                                                     ~14, ->31
    8    15    >   INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '%2C'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $15     
         19      > FE_RESET_R                                       $16     $15, ->30
         20    > > FE_FETCH_R                                               $16, !4, ->30
    9    21    >   INIT_FCALL                                               'filter_var'
         22        SEND_VAR                                                 !4
         23        SEND_VAL                                                 275
         24        SEND_VAL                                                 12582912
         25        DO_ICALL                                         $17     
         26        TYPE_CHECK                                  1018          $17
         27      > JMPZ                                                     ~18, ->29
   10    28    >   ASSIGN                                                   !0, !4
    8    29    > > JMP                                                      ->20
         30    >   FE_FREE                                                  $16
    5    31    > > JMP                                                      ->3
         32    >   FE_FREE                                                  $7
   15    33      > RETURN                                                   !0
   16    34*     > RETURN                                                   null

End of function getuserip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.99 ms | 1403 KiB | 18 Q