3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse_yturl($url) { $pattern = '#^(?:https?://)?(?:www|m\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x'; preg_match($pattern, $url, $matches); return isset($matches[1]) ? $matches[1] : false; } var_dump(parse_yturl("https://www.youtube.com/watch?v=i-6tLn6hQ7Q"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VfGbQ
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'parse_yturl'
          2        SEND_VAL                                                 'https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Di-6tLn6hQ7Q'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function parse_yturl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VfGbQ
function name:  parse_yturl
number of ops:  15
compiled vars:  !0 = $url, !1 = $pattern, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '%23%5E%28%3F%3Ahttps%3F%3A%2F%2F%29%3F%28%3F%3Awww%7Cm%5C.%29%3F%28%3F%3Ayoutu%5C.be%2F%7Cyoutube%5C.com%28%3F%3A%2Fembed%2F%7C%2Fv%2F%7C%2Fwatch%5C%3Fv%3D%7C%2Fwatch%5C%3F.%2B%26v%3D%29%29%28%5B%5Cw-%5D%7B11%7D%29%28%3F%3A.%2B%29%3F%24%23x'
    6     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    7     7        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 1
          8      > JMPZ                                                     ~5, ->12
          9    >   FETCH_DIM_R                                      ~6      !2, 1
         10        QM_ASSIGN                                        ~7      ~6
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      <false>
         13    > > RETURN                                                   ~7
    8    14*     > RETURN                                                   null

End of function parse_yturl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.52 ms | 1390 KiB | 18 Q