3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'http://#chrütli24/7schwur.ch'; $input = 'www.meinemüllerdomain.ch/index/checkMe?param#whatevs'; $input = 'www.jeng.cc'; $pattern = array(); $pattern[] = '/\xE2\x80\x8B/'; $pattern[] = '/ /'; $pattern[] = '@^[a-z]+://@i'; $pattern[] = '/&#8203;/'; $pattern[] = '/\?/'; $pattern[] = '@^www\.@i'; // if entered, remove whitespaces, prepending protocoll and www. $cleaned = preg_replace($pattern, null, idn_to_utf8(mb_strtolower($input, 'UTF-8'))); //echo $cleaned; // if entered, remove trailing dot $cleaned = (substr($cleaned, -1) == '.') ? substr($cleaned, 0, -1) : $cleaned; //echo $cleaned; if (strpos($cleaned, '@') !== false) { echo 'false'; } $val = filter_var(idn_to_ascii($cleaned), FILTER_VALIDATE_URL); var_dump($val); $correct = filter_var('http://'.$cleaned, FILTER_VALIDATE_URL); var_dump($correct); //var_dump(parse_url($correct)); $testdomain = idn_to_ascii($cleaned); var_dump(filter_var($testdomain, FILTER_VALIDATE_URL));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 42
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
Branch analysis from position: 51
filename:       /in/LPcLW
function name:  (null)
number of ops:  83
compiled vars:  !0 = $input, !1 = $pattern, !2 = $cleaned, !3 = $val, !4 = $correct, !5 = $testdomain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2F%23chr%C3%BCtli24%2F7schwur.ch'
    4     1        ASSIGN                                                   !0, 'www.meinem%C3%BCllerdomain.ch%2Findex%2FcheckMe%3Fparam%23whatevs'
    5     2        ASSIGN                                                   !0, 'www.jeng.cc'
    7     3        ASSIGN                                                   !1, <array>
    8     4        ASSIGN_DIM                                               !1
          5        OP_DATA                                                  '%2F%5CxE2%5Cx80%5Cx8B%2F'
    9     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  '%2F+%2F'
   10     8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  '%40%5E%5Ba-z%5D%2B%3A%2F%2F%40i'
   11    10        ASSIGN_DIM                                               !1
         11        OP_DATA                                                  '%2F%26%238203%3B%2F'
   12    12        ASSIGN_DIM                                               !1
         13        OP_DATA                                                  '%2F%5C%3F%2F'
   13    14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  '%40%5Ewww%5C.%40i'
   16    16        INIT_FCALL                                               'preg_replace'
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 null
         19        INIT_FCALL_BY_NAME                                       'idn_to_utf8'
         20        INIT_FCALL                                               'mb_strtolower'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 'UTF-8'
         23        DO_ICALL                                         $16     
         24        SEND_VAR_NO_REF_EX                                       $16
         25        DO_FCALL                                      0  $17     
         26        SEND_VAR                                                 $17
         27        DO_ICALL                                         $18     
         28        ASSIGN                                                   !2, $18
   20    29        INIT_FCALL                                               'substr'
         30        SEND_VAR                                                 !2
         31        SEND_VAL                                                 -1
         32        DO_ICALL                                         $20     
         33        IS_EQUAL                                                 $20, '.'
         34      > JMPZ                                                     ~21, ->42
         35    >   INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !2
         37        SEND_VAL                                                 0
         38        SEND_VAL                                                 -1
         39        DO_ICALL                                         $22     
         40        QM_ASSIGN                                        ~23     $22
         41      > JMP                                                      ->43
         42    >   QM_ASSIGN                                        ~23     !2
         43    >   ASSIGN                                                   !2, ~23
   23    44        INIT_FCALL                                               'strpos'
         45        SEND_VAR                                                 !2
         46        SEND_VAL                                                 '%40'
         47        DO_ICALL                                         $25     
         48        TYPE_CHECK                                  1018          $25
         49      > JMPZ                                                     ~26, ->51
   24    50    >   ECHO                                                     'false'
   27    51    >   INIT_FCALL                                               'filter_var'
         52        INIT_FCALL_BY_NAME                                       'idn_to_ascii'
         53        SEND_VAR_EX                                              !2
         54        DO_FCALL                                      0  $27     
         55        SEND_VAR                                                 $27
         56        SEND_VAL                                                 273
         57        DO_ICALL                                         $28     
         58        ASSIGN                                                   !3, $28
   28    59        INIT_FCALL                                               'var_dump'
         60        SEND_VAR                                                 !3
         61        DO_ICALL                                                 
   30    62        INIT_FCALL                                               'filter_var'
         63        CONCAT                                           ~31     'http%3A%2F%2F', !2
         64        SEND_VAL                                                 ~31
         65        SEND_VAL                                                 273
         66        DO_ICALL                                         $32     
         67        ASSIGN                                                   !4, $32
   31    68        INIT_FCALL                                               'var_dump'
         69        SEND_VAR                                                 !4
         70        DO_ICALL                                                 
   35    71        INIT_FCALL_BY_NAME                                       'idn_to_ascii'
         72        SEND_VAR_EX                                              !2
         73        DO_FCALL                                      0  $35     
         74        ASSIGN                                                   !5, $35
   36    75        INIT_FCALL                                               'var_dump'
         76        INIT_FCALL                                               'filter_var'
         77        SEND_VAR                                                 !5
         78        SEND_VAL                                                 273
         79        DO_ICALL                                         $37     
         80        SEND_VAR                                                 $37
         81        DO_ICALL                                                 
         82      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.18 ms | 1404 KiB | 25 Q