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 = "http://www.youtube.com/watch?v=ty9QSiVC2g0"; $youtube_id = (preg_replace($pattern, '$1', $youtube_url)); var_dump ($youtube_id);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hMes8
function name:  (null)
number of ops:  12
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, 'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dty9QSiVC2g0'
    7     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 '%241'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
    8     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.69 ms | 1394 KiB | 17 Q