3v4l.org

run code in 300+ PHP versions simultaneously
<?php function extractVars($pattern){ //Extract if function $array_vars = []; $rgx = '/^(?<startOfS>.*?)\{=IF\((device=mobile|audience IN\(.*?\)),(.*?)\):(.*?)\}(?<endOfS>.*?)$/'; preg_match_all($rgx, $pattern, $matches, PREG_SET_ORDER, 0); print_r($matches); return $array_vars; } $var = extractVars("Get The Best Shoes At The Best Price. {=IF(device=mobile,Free Shipping on Mobile Orders!):Buy Now!}"); print_r($var);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B5DTH
function name:  (null)
number of ops:  8
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'extractvars'
          1        SEND_VAL                                                 'Get+The+Best+Shoes+At+The+Best+Price.+%7B%3DIF%28device%3Dmobile%2CFree+Shipping+on+Mobile+Orders%21%29%3ABuy+Now%21%7D'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   15     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function extractvars:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B5DTH
function name:  extractVars
number of ops:  15
compiled vars:  !0 = $pattern, !1 = $array_vars, !2 = $rgx, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, '%2F%5E%28%3F%3CstartOfS%3E.%2A%3F%29%5C%7B%3DIF%5C%28%28device%3Dmobile%7Caudience+IN%5C%28.%2A%3F%5C%29%29%2C%28.%2A%3F%29%5C%29%3A%28.%2A%3F%29%5C%7D%28%3F%3CendOfS%3E.%2A%3F%29%24%2F'
    7     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !3
          7        SEND_VAL                                                 2
          8        SEND_VAL                                                 0
          9        DO_ICALL                                                 
    9    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                                 
   10    13      > RETURN                                                   !1
   11    14*     > RETURN                                                   null

End of function extractvars

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.03 ms | 1398 KiB | 18 Q