3v4l.org

run code in 300+ PHP versions simultaneously
<?php $match = preg_replace_callback(array('/\d/', '/a/'), function($matches)use(&$result){ $result[] = $matches[0]; return '_'; }, 'ada2d1', 1); print_r($match); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2LcP
function name:  (null)
number of ops:  16
compiled vars:  !0 = $match, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'preg_replace_callback'
          1        SEND_VAL                                                 <array>
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX2LcP%3A2%240'
          3        BIND_LEXICAL                                             ~2, !1
    5     4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 'ada2d1'
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $3      
    2     8        ASSIGN                                                   !0, $3
    6     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
    7    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FX2LcP%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2LcP
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $matches, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    3     2        FETCH_DIM_R                                      ~3      !0, 0
          3        ASSIGN_DIM                                               !1
          4        OP_DATA                                                  ~3
    4     5      > RETURN                                                   '_'
    5     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX2LcP%3A2%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.96 ms | 1387 KiB | 17 Q