3v4l.org

run code in 500+ PHP versions simultaneously
<?php function is_valid($string) { return preg_match('~(\((?1)*+\)|\[(?1)*+]|{(?1)*+})*\z~A', $string); } $expressions = array(")(){}", "[]({})", "([])", "{()[]}", "([)]", "{()[]}{()[]}{()[]}{()[]}{()[]}"); foreach ($expressions as $expression) { echo "$expression is " , is_valid($expression) , "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/kMOML
function name:  (null)
number of ops:  14
compiled vars:  !0 = $expressions, !1 = $expression
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                       !0, <array>
    7     1      > FE_RESET_R                                           $3      !0, ->12
          2    > > FE_FETCH_R                                                   $3, !1, ->12
    8     3    >   NOP                                                          
          4        FAST_CONCAT                                          ~4      !1, '+is+'
          5        ECHO                                                         ~4
          6        INIT_FCALL                                                   'is_valid'
          7        SEND_VAR                                                     !1
          8        DO_FCALL                                          0  $5      
          9        ECHO                                                         $5
         10        ECHO                                                         '%0A'
    7    11      > JMP                                                          ->2
         12    >   FE_FREE                                                      $3
    9    13      > RETURN                                                       1

Function is_valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kMOML
function name:  is_valid
number of ops:  4
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        FRAMELESS_ICALL_2                preg_match          ~1      '%7E%28%5C%28%28%3F1%29%2A%2B%5C%29%7C%5C%5B%28%3F1%29%2A%2B%5D%7C%7B%28%3F1%29%2A%2B%7D%29%2A%5Cz%7EA', !0
          2      > RETURN                                                       ~1
    4     3*     > RETURN                                                       null

End of function is_valid

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.29 ms | 2080 KiB | 14 Q