3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/@if\h*(\(((?:[^()]++|(?1))*)\))\s*(.*?)\s*@endif\b/is'; $s = '@if(!empty($title))test and testing@endif'; $subst = "<?php if($2) { ?>$3<?php } ?>"; $result = preg_replace($pattern, $subst, $s); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yb7up
function name:  (null)
number of ops:  11
compiled vars:  !0 = $pattern, !1 = $s, !2 = $subst, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%40if%5Ch%2A%28%5C%28%28%28%3F%3A%5B%5E%28%29%5D%2B%2B%7C%28%3F1%29%29%2A%29%5C%29%29%5Cs%2A%28.%2A%3F%29%5Cs%2A%40endif%5Cb%2Fis'
    4     1        ASSIGN                                                   !1, '%40if%28%21empty%28%24title%29%29test%0Aand+testing%40endif'
    6     2        ASSIGN                                                   !2, '%3C%3Fphp+if%28%242%29+%7B+%3F%3E%243%3C%3Fphp+%7D+%3F%3E'
    8     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   10     9        ECHO                                                     !3
   11    10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.76 ms | 1009 KiB | 14 Q