3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i'; $youtube_url = array( "https://youtu.be/yVpbFMhOAwE", "https://www.youtube.com/embed/yVpbFMhOAwE", "youtu.be/yVpbFMhOAwE", "youtube.com/watch?v=yVpbFMhOAwE", "http://youtu.be/yVpbFMhOAwE", "http://www.youtube.com/embed/yVpbFMhOAwE", "http://www.youtube.com/watch?v=yVpbFMhOAwE", "http://www.youtube.com/watch?v=yVpbFMhOAwE&feature=g-vrec", "http://www.youtube.com/watch?v=yVpbFMhOAwE&feature=player_embedded", "http://www.youtube.com/v/yVpbFMhOAwE?fs=1&hl=en_US", "http://www.youtube.com/ytscreeningroom?v=yVpbFMhOAwE", "http://www.youtube.com/watch?NR=1&feature=endscreen&v=yVpbFMhOAwE", "http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo", "http://www.youtube.com/watch?v=6zUVS4kJtrA&feature=c4-overview-vl&list=PLbzoR-pLrL6qucl8-lOnzvhFc2UM1tcZA", ); foreach($youtube_url as $youtube_url) { $youtube_id = (preg_replace($pattern, '$1', $youtube_url)); var_dump ($youtube_id); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/qs26V
function name:  (null)
number of ops:  16
compiled vars:  !0 = $pattern, !1 = $youtube_url, !2 = $youtube_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7E%28%3F%3Ahttp%7Chttps%7C%29%28%3F%3A%3A%5C%2F%5C%2F%7C%29%28%3F%3Awww.%7C%29%28%3F%3Ayoutu%5C.be%5C%2F%7Cyoutube%5C.com%28%3F%3A%5C%2Fembed%5C%2F%7C%5C%2Fv%5C%2F%7C%5C%2Fwatch%5C%3Fv%3D%7C%5C%2Fytscreeningroom%5C%3Fv%3D%7C%5C%2Ffeeds%5C%2Fapi%5C%2Fvideos%5C%2F%7C%5C%2Fuser%5CS%2A%5B%5E%5Cw%5C-%5Cs%5D%7C%5CS%2A%5B%5E%5Cw%5C-%5Cs%5D%29%29%28%5B%5Cw%5C-%5D%7B11%7D%29%5Ba-z0-9%3B%3A%40%3F%26%25%3D%2B%5C%2F%5C%24_.-%5D%2A%7Ei'
    5     1        ASSIGN                                                   !1, <array>
   22     2      > FE_RESET_R                                       $5      !1, ->14
          3    > > FE_FETCH_R                                               $5, !1, ->14
   23     4    >   INIT_FCALL                                               'preg_replace'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '%241'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !2, $6
   24    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   22    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $5
   25    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.98 ms | 1386 KiB | 17 Q