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( [ $pattern1 => function ($match) { echo "pattern 1: \n"; print_r($match); }, $pattern2 => function ($match) { echo "pattern 2: \n"; print_r($match); } ], $string );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YnA4A
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%2FYnA4A%3A10%240'
   13     5        INIT_ARRAY                                       ~7      ~6, !1
   14     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYnA4A%3A14%241'
   17     7        ADD_ARRAY_ELEMENT                                ~7      ~8, !2
          8        SEND_VAL                                                 ~7
   19     9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   20    11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FYnA4A%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YnA4A
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ECHO                                                     'pattern+1%3A+%0A'
   12     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   13     5      > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2FYnA4A%3A14%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YnA4A
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ECHO                                                     'pattern+2%3A+%0A'
   16     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   17     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYnA4A%3A14%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.78 ms | 1396 KiB | 17 Q