3v4l.org

run code in 500+ PHP versions simultaneously
<?php echo preg_replace_callback( '/^.|.\K./', fn() => rand(0,9), '1234567' ); echo "\n---\n"; echo preg_replace_callback( '/.\K./', fn() => rand(0,9), '1234567' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SI7i4
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'preg_replace_callback'
    4     1        SEND_VAL                                                     '%2F%5E.%7C.%5CK.%2F'
    5     2        DECLARE_LAMBDA_FUNCTION                              ~0      [0]
          3        SEND_VAL                                                     ~0
    6     4        SEND_VAL                                                     '1234567'
    3     5        DO_ICALL                                             $1      
    6     6        ECHO                                                         $1
    9     7        ECHO                                                         '%0A---%0A'
   11     8        INIT_FCALL                                                   'preg_replace_callback'
   12     9        SEND_VAL                                                     '%2F.%5CK.%2F'
   13    10        DECLARE_LAMBDA_FUNCTION                              ~2      [1]
         11        SEND_VAL                                                     ~2
   14    12        SEND_VAL                                                     '1234567'
   11    13        DO_ICALL                                             $3      
   14    14        ECHO                                                         $3
   15    15      > 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/SI7i4
function name:  {closure:/in/SI7i4:5}
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                                   'rand'
          1        SEND_VAL                                                     0
          2        SEND_VAL                                                     9
          3        DO_ICALL                                             $0      
          4      > RETURN                                                       $0
          5*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SI7i4
function name:  {closure:/in/SI7i4:13}
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'rand'
          1        SEND_VAL                                                     0
          2        SEND_VAL                                                     9
          3        DO_ICALL                                             $0      
          4      > RETURN                                                       $0
          5*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.14 ms | 1400 KiB | 15 Q