3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(filter_var('http://www.google.fr', FILTER_VALIDATE_URL)); var_dump(filter_var('www.google.fr', FILTER_VALIDATE_URL)); var_dump(filter_var('https://www.google.fr', FILTER_VALIDATE_URL)); var_dump(filter_var('google.fr', FILTER_VALIDATE_URL)); $regex = "((https?|ftp)\:\/\/)?"; // SCHEME $regex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; // User and Pass $regex .= "([a-z0-9-.]*)\.([a-z]{2,3})"; // Host or IP $regex .= "(\:[0-9]{2,5})?"; // Port $regex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?"; // Path $regex .= "(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?"; // GET Query $regex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?"; // Anchor var_dump(preg_match("/^$regex$/", 'http://www.google.fr')); var_dump(preg_match("/^$regex$/", 'www.google.fr')); var_dump(preg_match("/^$regex$/", 'https://www.google.fr')); var_dump(preg_match("/^$regex$/", 'google.fr')); var_dump(preg_match("/^$regex$/", 'www.example.com/etcetc')); var_dump(preg_match("/^$regex$/", 'test.fr/test-test.html?test=1e#test')); var_dump(preg_match("/^$regex$/", 'http://www.example.com/etcetc'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/davQq
function name:  (null)
number of ops:  106
compiled vars:  !0 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'filter_var'
          2        SEND_VAL                                                 'http%3A%2F%2Fwww.google.fr'
          3        SEND_VAL                                                 273
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                                 
    4     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'filter_var'
          9        SEND_VAL                                                 'www.google.fr'
         10        SEND_VAL                                                 273
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                                 
    5    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'filter_var'
         16        SEND_VAL                                                 'https%3A%2F%2Fwww.google.fr'
         17        SEND_VAL                                                 273
         18        DO_ICALL                                         $5      
         19        SEND_VAR                                                 $5
         20        DO_ICALL                                                 
    6    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'filter_var'
         23        SEND_VAL                                                 'google.fr'
         24        SEND_VAL                                                 273
         25        DO_ICALL                                         $7      
         26        SEND_VAR                                                 $7
         27        DO_ICALL                                                 
    8    28        ASSIGN                                                   !0, '%28%28https%3F%7Cftp%29%5C%3A%5C%2F%5C%2F%29%3F'
    9    29        ASSIGN_OP                                     8          !0, '%28%5Ba-z0-9%2B%21%2A%28%29%2C%3B%3F%26%3D%24_.-%5D%2B%28%5C%3A%5Ba-z0-9%2B%21%2A%28%29%2C%3B%3F%26%3D%24_.-%5D%2B%29%3F%40%29%3F'
   10    30        ASSIGN_OP                                     8          !0, '%28%5Ba-z0-9-.%5D%2A%29%5C.%28%5Ba-z%5D%7B2%2C3%7D%29'
   11    31        ASSIGN_OP                                     8          !0, '%28%5C%3A%5B0-9%5D%7B2%2C5%7D%29%3F'
   12    32        ASSIGN_OP                                     8          !0, '%28%5C%2F%28%5Ba-z0-9%2B%24_-%5D%5C.%3F%29%2B%29%2A%5C%2F%3F'
   13    33        ASSIGN_OP                                     8          !0, '%28%5C%3F%5Ba-z%2B%26%24_.-%5D%5Ba-z0-9%3B%3A%40%26%25%3D%2B%5C%2F%24_.-%5D%2A%29%3F'
   14    34        ASSIGN_OP                                     8          !0, '%28%23%5Ba-z_.-%5D%5Ba-z0-9%2B%24_.-%5D%2A%29%3F'
   16    35        INIT_FCALL                                               'var_dump'
         36        INIT_FCALL                                               'preg_match'
         37        ROPE_INIT                                     3  ~17     '%2F%5E'
         38        ROPE_ADD                                      1  ~17     ~17, !0
         39        ROPE_END                                      2  ~16     ~17, '%24%2F'
         40        SEND_VAL                                                 ~16
         41        SEND_VAL                                                 'http%3A%2F%2Fwww.google.fr'
         42        DO_ICALL                                         $19     
         43        SEND_VAR                                                 $19
         44        DO_ICALL                                                 
   17    45        INIT_FCALL                                               'var_dump'
         46        INIT_FCALL                                               'preg_match'
         47        ROPE_INIT                                     3  ~22     '%2F%5E'
         48        ROPE_ADD                                      1  ~22     ~22, !0
         49        ROPE_END                                      2  ~21     ~22, '%24%2F'
         50        SEND_VAL                                                 ~21
         51        SEND_VAL                                                 'www.google.fr'
         52        DO_ICALL                                         $24     
         53        SEND_VAR                                                 $24
         54        DO_ICALL                                                 
   18    55        INIT_FCALL                                               'var_dump'
         56        INIT_FCALL                                               'preg_match'
         57        ROPE_INIT                                     3  ~27     '%2F%5E'
         58        ROPE_ADD                                      1  ~27     ~27, !0
         59        ROPE_END                                      2  ~26     ~27, '%24%2F'
         60        SEND_VAL                                                 ~26
         61        SEND_VAL                                                 'https%3A%2F%2Fwww.google.fr'
         62        DO_ICALL                                         $29     
         63        SEND_VAR                                                 $29
         64        DO_ICALL                                                 
   19    65        INIT_FCALL                                               'var_dump'
         66        INIT_FCALL                                               'preg_match'
         67        ROPE_INIT                                     3  ~32     '%2F%5E'
         68        ROPE_ADD                                      1  ~32     ~32, !0
         69        ROPE_END                                      2  ~31     ~32, '%24%2F'
         70        SEND_VAL                                                 ~31
         71        SEND_VAL                                                 'google.fr'
         72        DO_ICALL                                         $34     
         73        SEND_VAR                                                 $34
         74        DO_ICALL                                                 
   20    75        INIT_FCALL                                               'var_dump'
         76        INIT_FCALL                                               'preg_match'
         77        ROPE_INIT                                     3  ~37     '%2F%5E'
         78        ROPE_ADD                                      1  ~37     ~37, !0
         79        ROPE_END                                      2  ~36     ~37, '%24%2F'
         80        SEND_VAL                                                 ~36
         81        SEND_VAL                                                 'www.example.com%2Fetcetc'
         82        DO_ICALL                                         $39     
         83        SEND_VAR                                                 $39
         84        DO_ICALL                                                 
   21    85        INIT_FCALL                                               'var_dump'
         86        INIT_FCALL                                               'preg_match'
         87        ROPE_INIT                                     3  ~42     '%2F%5E'
         88        ROPE_ADD                                      1  ~42     ~42, !0
         89        ROPE_END                                      2  ~41     ~42, '%24%2F'
         90        SEND_VAL                                                 ~41
         91        SEND_VAL                                                 'test.fr%2Ftest-test.html%3Ftest%3D1e%23test'
         92        DO_ICALL                                         $44     
         93        SEND_VAR                                                 $44
         94        DO_ICALL                                                 
   22    95        INIT_FCALL                                               'var_dump'
         96        INIT_FCALL                                               'preg_match'
         97        ROPE_INIT                                     3  ~47     '%2F%5E'
         98        ROPE_ADD                                      1  ~47     ~47, !0
         99        ROPE_END                                      2  ~46     ~47, '%24%2F'
        100        SEND_VAL                                                 ~46
        101        SEND_VAL                                                 'http%3A%2F%2Fwww.example.com%2Fetcetc'
        102        DO_ICALL                                         $49     
        103        SEND_VAR                                                 $49
        104        DO_ICALL                                                 
        105      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.49 ms | 1404 KiB | 19 Q