3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('HAZELFENCES_WEBSITE', 'https://test.com'); $text = '[youtube]https://www.youtube.com/watch?v=xHLE2LTAItw&amp;t=53s[/youtube]'; $text .= '[youtube]https://www.youtube.com/watch?v=xHLE2LTAItw[/youtube]'; if (preg_match_all("/\[youtube\]((\s|.)+?)\[\/youtube\]/i", $text, $matches)) { $allMatches = count($matches[0]); if (is_array($matches[0]) && $allMatches > 0) { for ($i = 0; $i < $allMatches; $i++) { $text = str_replace("watch?v=", "embed/", $text); if (strpos($matches[0][$i], "&amp;t=") !== false) { $text = str_replace("&amp;t=", "?start=", $text); $text = preg_replace("#s\[\/youtube\]#i", "&enablejsapi=1&origin=". HAZELFENCES_WEBSITE ."[/youtube]", $text); } else { $text = preg_replace("#\[\/youtube\]#i", "?enablejsapi=1&origin=". HAZELFENCES_WEBSITE ."[/youtube]", $text); } } $text = preg_replace("/\[youtube\]((\s|.)+?)\[\/youtube\]/i", "<iframe width=\"640\" height=\"510\" src=\"\\1\" loading=\"lazy\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>", $text); } } echo $text;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 71
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 71
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 23
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 53
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 23
Branch analysis from position: 65
Branch analysis from position: 23
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 23
Branch analysis from position: 65
Branch analysis from position: 23
Branch analysis from position: 71
Branch analysis from position: 20
Branch analysis from position: 71
filename:       /in/XAlZT
function name:  (null)
number of ops:  73
compiled vars:  !0 = $text, !1 = $matches, !2 = $allMatches, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'HAZELFENCES_WEBSITE'
          2        SEND_VAL                                                 'https%3A%2F%2Ftest.com'
          3        DO_ICALL                                                 
    3     4        ASSIGN                                                   !0, '%5Byoutube%5Dhttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxHLE2LTAItw%26amp%3Bt%3D53s%5B%2Fyoutube%5D'
    4     5        ASSIGN_OP                                     8          !0, '%5Byoutube%5Dhttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxHLE2LTAItw%5B%2Fyoutube%5D'
    5     6        INIT_FCALL                                               'preg_match_all'
          7        SEND_VAL                                                 '%2F%5C%5Byoutube%5C%5D%28%28%5Cs%7C.%29%2B%3F%29%5C%5B%5C%2Fyoutube%5C%5D%2Fi'
          8        SEND_VAR                                                 !0
          9        SEND_REF                                                 !1
         10        DO_ICALL                                         $7      
         11      > JMPZ                                                     $7, ->71
    6    12    >   FETCH_DIM_R                                      ~8      !1, 0
         13        COUNT                                            ~9      ~8
         14        ASSIGN                                                   !2, ~9
    8    15        FETCH_DIM_R                                      ~11     !1, 0
         16        TYPE_CHECK                                  128  ~12     ~11
         17      > JMPZ_EX                                          ~12     ~12, ->20
         18    >   IS_SMALLER                                       ~13     0, !2
         19        BOOL                                             ~12     ~13
         20    > > JMPZ                                                     ~12, ->71
    9    21    >   ASSIGN                                                   !3, 0
         22      > JMP                                                      ->63
   10    23    >   INIT_FCALL                                               'str_replace'
         24        SEND_VAL                                                 'watch%3Fv%3D'
         25        SEND_VAL                                                 'embed%2F'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $15     
         28        ASSIGN                                                   !0, $15
   12    29        INIT_FCALL                                               'strpos'
         30        FETCH_DIM_R                                      ~17     !1, 0
         31        FETCH_DIM_R                                      ~18     ~17, !3
         32        SEND_VAL                                                 ~18
         33        SEND_VAL                                                 '%26amp%3Bt%3D'
         34        DO_ICALL                                         $19     
         35        TYPE_CHECK                                  1018          $19
         36      > JMPZ                                                     ~20, ->53
   13    37    >   INIT_FCALL                                               'str_replace'
         38        SEND_VAL                                                 '%26amp%3Bt%3D'
         39        SEND_VAL                                                 '%3Fstart%3D'
         40        SEND_VAR                                                 !0
         41        DO_ICALL                                         $21     
         42        ASSIGN                                                   !0, $21
   14    43        INIT_FCALL                                               'preg_replace'
         44        SEND_VAL                                                 '%23s%5C%5B%5C%2Fyoutube%5C%5D%23i'
         45        FETCH_CONSTANT                                   ~23     'HAZELFENCES_WEBSITE'
         46        CONCAT                                           ~24     '%26enablejsapi%3D1%26origin%3D', ~23
         47        CONCAT                                           ~25     ~24, '%5B%2Fyoutube%5D'
         48        SEND_VAL                                                 ~25
         49        SEND_VAR                                                 !0
         50        DO_ICALL                                         $26     
         51        ASSIGN                                                   !0, $26
   12    52      > JMP                                                      ->62
   16    53    >   INIT_FCALL                                               'preg_replace'
         54        SEND_VAL                                                 '%23%5C%5B%5C%2Fyoutube%5C%5D%23i'
         55        FETCH_CONSTANT                                   ~28     'HAZELFENCES_WEBSITE'
         56        CONCAT                                           ~29     '%3Fenablejsapi%3D1%26origin%3D', ~28
         57        CONCAT                                           ~30     ~29, '%5B%2Fyoutube%5D'
         58        SEND_VAL                                                 ~30
         59        SEND_VAR                                                 !0
         60        DO_ICALL                                         $31     
         61        ASSIGN                                                   !0, $31
    9    62    >   PRE_INC                                                  !3
         63    >   IS_SMALLER                                               !3, !2
         64      > JMPNZ                                                    ~34, ->23
   20    65    >   INIT_FCALL                                               'preg_replace'
         66        SEND_VAL                                                 '%2F%5C%5Byoutube%5C%5D%28%28%5Cs%7C.%29%2B%3F%29%5C%5B%5C%2Fyoutube%5C%5D%2Fi'
         67        SEND_VAL                                                 '%3Ciframe+width%3D%22640%22+height%3D%22510%22+src%3D%22%5C1%22+loading%3D%22lazy%22+frameborder%3D%220%22+allow%3D%22accelerometer%3B+autoplay%3B+encrypted-media%3B+gyroscope%3B+picture-in-picture%22+allowfullscreen%3E%3C%2Fiframe%3E'
         68        SEND_VAR                                                 !0
         69        DO_ICALL                                         $35     
         70        ASSIGN                                                   !0, $35
   24    71    >   ECHO                                                     !0
   25    72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.81 ms | 1011 KiB | 18 Q