3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bbCode = <<<BBCODE Here is some text <youtube=http://www.youtube.com/watch?v=VIDEO_ID&feature=channel> and some more text BBCODE; echo preg_replace_callback( '~<youtube=([^>]+)>~', function ($m) { parse_str(parse_url($m[1], PHP_URL_QUERY), $queryStringArray); $videoId = $queryStringArray['v'] ?? null; if (!$videoId) { return $m[0]; // do not replace bbcode because could not isolate the video id } return sprintf( '<object width="400" height="245"> <param name="movie" value="http://www.youtube-nocookie.com/v/%1$s&hl=en&fs=1&rel=0&showinfo=0"></param> <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube-nocookie.com/v/%1$s&hl=en&fs=1&rel=0&showinfo=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="245"></embed> </object>', $videoId ); }, $bbCode );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MYKdf
function name:  (null)
number of ops:  9
compiled vars:  !0 = $bbCode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Here+is+some+text+%3Cyoutube%3Dhttp%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVIDEO_ID%26feature%3Dchannel%3E+and+some+more+text'
    7     1        INIT_FCALL                                               'preg_replace_callback'
    8     2        SEND_VAL                                                 '%7E%3Cyoutube%3D%28%5B%5E%3E%5D%2B%29%3E%7E'
    9     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   23     4        SEND_VAL                                                 ~2
   24     5        SEND_VAR                                                 !0
    7     6        DO_ICALL                                         $3      
   24     7        ECHO                                                     $3
   25     8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MYKdf
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $m, !1 = $queryStringArray, !2 = $videoId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'parse_str'
          2        INIT_FCALL                                               'parse_url'
          3        FETCH_DIM_R                                      ~3      !0, 1
          4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 6
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
   11    10        FETCH_DIM_IS                                     ~6      !1, 'v'
         11        COALESCE                                         ~7      ~6
         12        QM_ASSIGN                                        ~7      null
         13        ASSIGN                                                   !2, ~7
   12    14        BOOL_NOT                                         ~9      !2
         15      > JMPZ                                                     ~9, ->18
   13    16    >   FETCH_DIM_R                                      ~10     !0, 0
         17      > RETURN                                                   ~10
   15    18    >   INIT_FCALL                                               'sprintf'
   16    19        SEND_VAL                                                 '%3Cobject+width%3D%22400%22+height%3D%22245%22%3E%0A+++++++++++++++++++++++++++++%3Cparam+name%3D%22movie%22+value%3D%22http%3A%2F%2Fwww.youtube-nocookie.com%2Fv%2F%251%24s%26hl%3Den%26fs%3D1%26rel%3D0%26showinfo%3D0%22%3E%3C%2Fparam%3E%0A+++++++++++++++++++++++++++++%3Cparam+name%3D%22allowFullScreen%22+value%3D%22true%22%3E%3C%2Fparam%3E%3Cparam+name%3D%22allowscriptaccess%22+value%3D%22always%22%3E%3C%2Fparam%3E%0A+++++++++++++++++++++++++++++%3Cembed+src%3D%22http%3A%2F%2Fwww.youtube-nocookie.com%2Fv%2F%251%24s%26hl%3Den%26fs%3D1%26rel%3D0%26showinfo%3D0%22+type%3D%22application%2Fx-shockwave-flash%22+allowscriptaccess%3D%22always%22+allowfullscreen%3D%22true%22+width%3D%22400%22+height%3D%22245%22%3E%3C%2Fembed%3E%0A+++++++++++++++++++++++++%3C%2Fobject%3E'
   21    20        SEND_VAR                                                 !2
   15    21        DO_ICALL                                         $11     
   21    22      > RETURN                                                   $11
   23    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.73 ms | 1008 KiB | 17 Q