3v4l.org

run code in 300+ PHP versions simultaneously
<?php $videoURLs = array( 'http://www.youtube.com/embed/VIDEO_ID', 'http://youtu.be/VIDEO_ID', 'http://www.youtube.com/v/VIDEO_ID', 'http://www.youtube.com/watch?v=VIDEO_ID', ); foreach ($videoURLs as $urlNow) { $url = parse_url($urlNow); #$url['path'] = str_replace(array('/v/', '/embed/', '/'), '', $url['path']); $url['path'] = end(explode('/', $url['path'])); $videoID = $url['path']; if (isset($url['query'])) { parse_str($url['query'], $query); $videoID = $query['v']; } var_dump($urlNow, $videoID); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 33
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 28
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/IZWgS
function name:  (null)
number of ops:  35
compiled vars:  !0 = $videoURLs, !1 = $urlNow, !2 = $url, !3 = $videoID, !4 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_R                                       $6      !0, ->33
          2    > > FE_FETCH_R                                               $6, !1, ->33
   10     3    >   INIT_FCALL                                               'parse_url'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   12     7        INIT_FCALL                                               'end'
          8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%2F'
         10        FETCH_DIM_R                                      ~10     !2, 'path'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                         $11     
         13        SEND_VAR_NO_REF                               0          $11
         14        DO_ICALL                                         $12     
         15        ASSIGN_DIM                                               !2, 'path'
         16        OP_DATA                                                  $12
   14    17        FETCH_DIM_R                                      ~13     !2, 'path'
         18        ASSIGN                                                   !3, ~13
   15    19        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'query'
         20      > JMPZ                                                     ~15, ->28
   16    21    >   INIT_FCALL                                               'parse_str'
         22        FETCH_DIM_R                                      ~16     !2, 'query'
         23        SEND_VAL                                                 ~16
         24        SEND_REF                                                 !4
         25        DO_ICALL                                                 
   17    26        FETCH_DIM_R                                      ~18     !4, 'v'
         27        ASSIGN                                                   !3, ~18
   20    28    >   INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !1
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                                 
    9    32      > JMP                                                      ->2
         33    >   FE_FREE                                                  $6
   22    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.24 ms | 1396 KiB | 23 Q