3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(!function_exists('filter_var')) die('filter_var not available'); foreach(array( '', 'x', ' ', '0.0.0.0', '255.255.255.255', // Some bad IP '127.0.0.1', // localhost '10.0.0.0', '192.168.0.1', 'fe80::414a:a44e:53f2:e694%21', 'fe80::414a:a44e:53f2:e694', // Private IP addresses '8.8.8.8', '88.149.1.2', // Good IPv4 '2607:f0d0:1002:51::4', '2001:4860:b002::68', '2001:0db8:85a3:0042:1000:8a2e:0370:7334', // Good IPv6 ) as $ip) { echo "v4 '$ip' => "; var_dump(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 + FILTER_FLAG_NO_PRIV_RANGE + FILTER_FLAG_NO_RES_RANGE)); echo "v6 '$ip' => "; var_dump(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 + FILTER_FLAG_NO_PRIV_RANGE + FILTER_FLAG_NO_RES_RANGE)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 33
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 33
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/XvMNp
function name:  (null)
number of ops:  35
compiled vars:  !0 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'filter_var'
          2        DO_ICALL                                         $1      
          3        BOOL_NOT                                         ~2      $1
          4      > JMPZ                                                     ~2, ->6
          5    > > EXIT                                                     'filter_var+not+available'
    4     6    > > FE_RESET_R                                       $3      <array>, ->33
          7    > > FE_FETCH_R                                               $3, !0, ->33
   10     8    >   ROPE_INIT                                     3  ~5      'v4+%27'
          9        ROPE_ADD                                      1  ~5      ~5, !0
         10        ROPE_END                                      2  ~4      ~5, '%27+%3D%3E+'
         11        ECHO                                                     ~4
         12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'filter_var'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 275
         16        SEND_VAL                                                 13631488
         17        DO_ICALL                                         $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                                 
   11    20        ROPE_INIT                                     3  ~10     'v6+%27'
         21        ROPE_ADD                                      1  ~10     ~10, !0
         22        ROPE_END                                      2  ~9      ~10, '%27+%3D%3E+'
         23        ECHO                                                     ~9
         24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'filter_var'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 275
         28        SEND_VAL                                                 14680064
         29        DO_ICALL                                         $12     
         30        SEND_VAR                                                 $12
         31        DO_ICALL                                                 
    4    32      > JMP                                                      ->7
         33    >   FE_FREE                                                  $3
   12    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.76 ms | 1388 KiB | 19 Q