3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.93 ms | 1388 KiB | 25 Q