3v4l.org

run code in 500+ PHP versions simultaneously
<?php $vars = [ "profitPercent", "productPrice", "weight", "quantityInCart", "lineTotal", "cartTotal", "billingUnits", "test_111", "test_213", "test_prod_input_15", "test_prod_input_16" ]; $chars = ["\d", "(", ".", "*", "+", "/"]; $algo = 'this is a string with a {productPrice} variable and some 827/100 math in it'; $pattern = "~(?:{" . implode('}|{', $vars) . '}|[' . implode('', $chars) . ']+)~'; preg_match_all($pattern, $algo, $matches); echo implode('', $matches[0]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vfD7
function name:  (null)
number of ops:  19
compiled vars:  !0 = $vars, !1 = $chars, !2 = $algo, !3 = $pattern, !4 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   18     1        ASSIGN                                                       !1, <array>
   19     2        ASSIGN                                                       !2, 'this+is+a+string+with+a+%7BproductPrice%7D+variable+and+some+827%2F100+math+in+it'
   20     3        FRAMELESS_ICALL_2                implode             ~8      '%7D%7C%7B', !0
          4        CONCAT                                               ~9      '%7E%28%3F%3A%7B', ~8
          5        CONCAT                                               ~10     ~9, '%7D%7C%5B'
          6        FRAMELESS_ICALL_2                implode             ~11     '', !1
          7        CONCAT                                               ~12     ~10, ~11
          8        CONCAT                                               ~13     ~12, '%5D%2B%29%7E'
          9        ASSIGN                                                       !3, ~13
   21    10        INIT_FCALL                                                   'preg_match_all'
         11        SEND_VAR                                                     !3
         12        SEND_VAR                                                     !2
         13        SEND_REF                                                     !4
         14        DO_ICALL                                                     
   22    15        FETCH_DIM_R                                          ~16     !4, 0
         16        FRAMELESS_ICALL_2                implode             ~17     '', ~16
         17        ECHO                                                         ~17
         18      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.75 ms | 478 KiB | 8 Q