3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "The Chernobyl disaster was a catastrophic nuclear accident that occurred on 26 April 1986, in the No. 4 nuclear reactor at the Chernobyl Nuclear Power Plant, near the city of Pripyat, in the north of the Ukrainian SSR."; $pattern1 = '%[A-Z]\w+%'; $pattern2 = '%\d+%'; 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; } ], $string );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RmWAV
function name:  (null)
number of ops:  12
compiled vars:  !0 = $string, !1 = $pattern1, !2 = $pattern2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'The+Chernobyl+disaster+was+a+catastrophic+nuclear+accident+that+occurred+on+26+April+1986%2C+in+the+No.+4+nuclear+reactor+at+the+Chernobyl+Nuclear+Power+Plant%2C+near+the+city+of+Pripyat%2C+in+the+north+of+the+Ukrainian+SSR.'
    5     1        ASSIGN                                                   !1, '%25%5BA-Z%5D%5Cw%2B%25'
    6     2        ASSIGN                                                   !2, '%25%5Cd%2B%25'
    8     3        INIT_FCALL                                               'preg_replace_callback_array'
   10     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRmWAV%3A10%240'
   12     5        INIT_ARRAY                                       ~7      ~6, '%7E%5Ba%5D%2B%7Ei'
   13     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRmWAV%3A13%241'
   15     7        ADD_ARRAY_ELEMENT                                ~7      ~8, '%7E%5Bb%5D%2B%7Ei'
          8        SEND_VAL                                                 ~7
   17     9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   18    11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FRmWAV%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RmWAV
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+%22a%22+found'
          5        ECHO                                                     '%0A'
   12     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRmWAV%3A10%240

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

End of function %00%7Bclosure%7D%2Fin%2FRmWAV%3A13%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.16 ms | 1396 KiB | 15 Q