3v4l.org

run code in 300+ PHP versions simultaneously
<?php $video_url = 'http://www.google.com'; $needles = array('http://', 'https://'); // Normalise the URLs foreach ($needles as $key => $needle) { if (strpos($video_url, $needle) === false) { unset($needles[$key]); } } if (count($needles)) { $video_url = $video_url; } else { $video_url = 'http://' . $video_url; } echo $video_url;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/3gLIc
function name:  (null)
number of ops:  22
compiled vars:  !0 = $video_url, !1 = $needles, !2 = $needle, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.google.com'
    5     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $6      !1, ->13
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->13
          4    >   ASSIGN                                                   !3, ~7
    9     5        INIT_FCALL                                               'strpos'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $9      
          9        TYPE_CHECK                                    4          $9
         10      > JMPZ                                                     ~10, ->12
   10    11    >   UNSET_DIM                                                !1, !3
    8    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $6
   14    14        COUNT                                            ~11     !1
         15      > JMPZ                                                     ~11, ->18
   15    16    >   ASSIGN                                                   !0, !0
         17      > JMP                                                      ->20
   17    18    >   CONCAT                                           ~13     'http%3A%2F%2F', !0
         19        ASSIGN                                                   !0, ~13
   20    20    >   ECHO                                                     !0
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.73 ms | 1387 KiB | 15 Q