3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_video_block($id) { return "***replacement text for $id***"; } function display_video($text) { return preg_replace_callback( '/\[VIDEO ID=(\d+)]/', function($m) { return get_video_block($m[1]); }, $text ); } echo display_video("Here is a video [VIDEO ID=33] to watch");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dAUbG
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'display_video'
          1        SEND_VAL                                                 'Here+is+a+video+%5BVIDEO+ID%3D33%5D+to+watch'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function get_video_block:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dAUbG
function name:  get_video_block
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ROPE_INIT                                     3  ~2      '%2A%2A%2Areplacement+text+for+'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%2A%2A%2A'
          4      > RETURN                                                   ~1
    5     5*     > RETURN                                                   null

End of function get_video_block

Function display_video:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dAUbG
function name:  display_video
number of ops:  9
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'preg_replace_callback'
    9     2        SEND_VAL                                                 '%2F%5C%5BVIDEO+ID%3D%28%5Cd%2B%29%5D%2F'
   10     3        DECLARE_LAMBDA_FUNCTION                          ~1      [0]
   12     4        SEND_VAL                                                 ~1
   13     5        SEND_VAR                                                 !0
    8     6        DO_ICALL                                         $2      
   13     7      > RETURN                                                   $2
   15     8*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dAUbG
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'get_video_block'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   12     6*     > RETURN                                                   null

End of Dynamic Function 0

End of function display_video

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.58 ms | 995 KiB | 16 Q