3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '//google.com/fgdgfg/rt'; if (filter_var($string, FILTER_VALIDATE_URL)) { return $string; } $string = trim($string); $string = str_replace(' ', '', $string); $string = iconv('utf-8', 'us-ascii//TRANSLIT', $string); if (!preg_match('/^https?:\/\//', $string)) { $string = 'http://' . $string; } if (!filter_var($string, FILTER_VALIDATE_URL)) { throw new Exception('Ссылка'); } echo $string;
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
Jump found. Position 1 = -2
Branch analysis from position: 7
Jump found. Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
Jump found. Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
Jump found. Position 1 = -2
Branch analysis from position: 41
Jump found. Position 1 = -2
Branch analysis from position: 31
filename:       /in/1uN6B
function name:  (null)
number of ops:  43
compiled vars:  !0 = $string
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, '%2F%2Fgoogle.com%2Ffgdgfg%2Frt'
   4     1        INIT_FCALL                                               'filter_var'
         2        SEND_VAR                                                 !0
         3        SEND_VAL                                                 273
         4        DO_ICALL                                         $2      
         5      > JMPZ                                                     $2, ->7
   5     6    > > RETURN                                                   !0
   8     7    >   INIT_FCALL                                               'trim'
         8        SEND_VAR                                                 !0
         9        DO_ICALL                                         $3      
        10        ASSIGN                                                   !0, $3
   9    11        INIT_FCALL                                               'str_replace'
        12        SEND_VAL                                                 '+'
        13        SEND_VAL                                                 ''
        14        SEND_VAR                                                 !0
        15        DO_ICALL                                         $5      
        16        ASSIGN                                                   !0, $5
  10    17        INIT_FCALL                                               'iconv'
        18        SEND_VAL                                                 'utf-8'
        19        SEND_VAL                                                 'us-ascii%2F%2FTRANSLIT'
        20        SEND_VAR                                                 !0
        21        DO_ICALL                                         $7      
        22        ASSIGN                                                   !0, $7
  11    23        INIT_FCALL                                               'preg_match'
        24        SEND_VAL                                                 '%2F%5Ehttps%3F%3A%5C%2F%5C%2F%2F'
        25        SEND_VAR                                                 !0
        26        DO_ICALL                                         $9      
        27        BOOL_NOT                                         ~10     $9
        28      > JMPZ                                                     ~10, ->31
  12    29    >   CONCAT                                           ~11     'http%3A%2F%2F', !0
        30        ASSIGN                                                   !0, ~11
  15    31    >   INIT_FCALL                                               'filter_var'
        32        SEND_VAR                                                 !0
        33        SEND_VAL                                                 273
        34        DO_ICALL                                         $13     
        35        BOOL_NOT                                         ~14     $13
        36      > JMPZ                                                     ~14, ->41
  16    37    >   NEW                                              $15     :9
        38        SEND_VAL_EX                                              '%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B0'
        39        DO_FCALL                                      0          
        40      > THROW                                         0          $15
  19    41    >   ECHO                                                     !0
        42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0