3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cart = "1+10,2+10,3+10,5+10,6+10"; $product = 3; $change = 5; $finalcart = preg_replace_callback("/(.*" .$product . "\+)(\d+)(.*)/", function($m) use($change){ return $m[1] . ($m[2]+$change) . $m[3]; }, $cart); Echo $finalcart;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XHDXH
function name:  (null)
number of ops:  15
compiled vars:  !0 = $cart, !1 = $product, !2 = $change, !3 = $finalcart
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1%2B10%2C2%2B10%2C3%2B10%2C5%2B10%2C6%2B10'
    5     1        ASSIGN                                                   !1, 3
    6     2        ASSIGN                                                   !2, 5
    8     3        INIT_FCALL                                               'preg_replace_callback'
          4        CONCAT                                           ~7      '%2F%28.%2A', !1
          5        CONCAT                                           ~8      ~7, '%5C%2B%29%28%5Cd%2B%29%28.%2A%29%2F'
          6        SEND_VAL                                                 ~8
          7        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
          8        BIND_LEXICAL                                             ~9, !2
   10     9        SEND_VAL                                                 ~9
         10        SEND_VAR                                                 !0
    8    11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !3, $10
   11    13        ECHO                                                     !3
   12    14      > 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/XHDXH
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $m, !1 = $change
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    9     2        FETCH_DIM_R                                      ~2      !0, 1
          3        FETCH_DIM_R                                      ~3      !0, 2
          4        ADD                                              ~4      ~3, !1
          5        CONCAT                                           ~5      ~2, ~4
          6        FETCH_DIM_R                                      ~6      !0, 3
          7        CONCAT                                           ~7      ~5, ~6
          8      > RETURN                                                   ~7
   10     9*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.03 ms | 1000 KiB | 14 Q