3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = 'Aaaafaba Bbab'; $ret = preg_replace_callback_array( [ '~[a]+~i' => function ($match) { echo strlen($match[0]), ' matches for "a" found', PHP_EOL; }, '~[b]+~i' => function ($match) { echo strlen($match[0]), ' matches for "b" found', PHP_EOL; } ], $subject ); var_dump($ret); var_dump($subject);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9pdS
function name:  (null)
number of ops:  17
compiled vars:  !0 = $subject, !1 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Aaaafaba+Bbab'
    5     1        INIT_FCALL                                               'preg_replace_callback_array'
    7     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fi9pdS%3A7%240'
    9     3        INIT_ARRAY                                       ~4      ~3, '%7E%5Ba%5D%2B%7Ei'
   10     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fi9pdS%3A10%241'
   12     5        ADD_ARRAY_ELEMENT                                ~4      ~5, '%7E%5Bb%5D%2B%7Ei'
          6        SEND_VAL                                                 ~4
   14     7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
    5     9        ASSIGN                                                   !1, $6
   17    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   18    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fi9pdS%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9pdS
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_DIM_R                                      ~1      !0, 0
          2        STRLEN                                           ~2      ~1
          3        ECHO                                                     ~2
          4        ECHO                                                     '+matches+for+%22a%22+found'
          5        ECHO                                                     '%0A'
    9     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fi9pdS%3A7%240

Function %00%7Bclosure%7D%2Fin%2Fi9pdS%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9pdS
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_DIM_R                                      ~1      !0, 0
          2        STRLEN                                           ~2      ~1
          3        ECHO                                                     ~2
          4        ECHO                                                     '+matches+for+%22b%22+found'
          5        ECHO                                                     '%0A'
   12     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fi9pdS%3A10%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.47 ms | 1396 KiB | 17 Q