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']); $pathParts = explode('/', $url['path']); $url['path'] = end($pathParts); $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 = 34
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 34
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 29
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/61mbC
function name:  (null)
number of ops:  36
compiled vars:  !0 = $videoURLs, !1 = $urlNow, !2 = $url, !3 = $pathParts, !4 = $videoID, !5 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_R                                       $7      !0, ->34
          2    > > FE_FETCH_R                                               $7, !1, ->34
   10     3    >   INIT_FCALL                                               'parse_url'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
   12     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2F'
          9        FETCH_DIM_R                                      ~10     !2, 'path'
         10        SEND_VAL                                                 ~10
         11        DO_ICALL                                         $11     
         12        ASSIGN                                                   !3, $11
   13    13        INIT_FCALL                                               'end'
         14        SEND_REF                                                 !3
         15        DO_ICALL                                         $14     
         16        ASSIGN_DIM                                               !2, 'path'
         17        OP_DATA                                                  $14
   15    18        FETCH_DIM_R                                      ~15     !2, 'path'
         19        ASSIGN                                                   !4, ~15
   16    20        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'query'
         21      > JMPZ                                                     ~17, ->29
   17    22    >   INIT_FCALL                                               'parse_str'
         23        FETCH_DIM_R                                      ~18     !2, 'query'
         24        SEND_VAL                                                 ~18
         25        SEND_REF                                                 !5
         26        DO_ICALL                                                 
   18    27        FETCH_DIM_R                                      ~20     !5, 'v'
         28        ASSIGN                                                   !4, ~20
   21    29    >   INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !1
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                                 
    9    33      > JMP                                                      ->2
         34    >   FE_FREE                                                  $7
   23    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.87 ms | 1396 KiB | 23 Q