3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = '@if ($user->loggedIn() || true) <p>welcome {{$user->name}}</p> @endif @if (true) <p>hello</p> @endif'; $replacements = array( '/{{(.+?)}}/' => '<?php echo $1; ?>', '/@if\s*\((.+)\)/' => '<?php if ($1): ?>', '/@endif/' => '<?php endif; ?>' ); echo preg_replace(array_keys($replacements), $replacements, $code);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v254b
function name:  (null)
number of ops:  12
compiled vars:  !0 = $code, !1 = $replacements
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%40if+%28%24user-%3EloggedIn%28%29+%7C%7C+true%29%0A%0A++++%3Cp%3Ewelcome+%7B%7B%24user-%3Ename%7D%7D%3C%2Fp%3E%0A%0A%40endif%0A%0A%40if+%28true%29%0A%0A++++%3Cp%3Ehello%3C%2Fp%3E%0A%0A%40endif'
   13     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'preg_replace'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.84 ms | 1010 KiB | 15 Q