3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = ['yellow', 'green', 'red']; $myString = 'banana is ?, apple is ?, tomato is ?'; echo preg_replace_callback( '/\?/', function() use ($myArray) { static $i = 0; return $myArray[$i++]; }, $myString );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T61or
function name:  (null)
number of ops:  11
compiled vars:  !0 = $myArray, !1 = $myString
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 'banana+is+%3F%2C+apple+is+%3F%2C+tomato+is+%3F'
    7     2        INIT_FCALL                                               'preg_replace_callback'
    8     3        SEND_VAL                                                 '%2F%5C%3F%2F'
    9     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !0
   12     6        SEND_VAL                                                 ~4
   13     7        SEND_VAR                                                 !1
    7     8        DO_ICALL                                         $5      
   13     9        ECHO                                                     $5
   14    10      > RETURN                                                   1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.29 ms | 1069 KiB | 14 Q