3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "($a * 10 + $b) Euro and (10 + 2) cents"; $regex = '#\((([^()]+|(?R))*)\)#'; if (preg_match_all($regex, $string ,$matches)) { echo var_export($matches[1], true); } else { //no parenthesis echo $string; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/taQYB
function name:  (null)
number of ops:  22
compiled vars:  !0 = $string, !1 = $a, !2 = $b, !3 = $regex, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ROPE_INIT                                     5  ~6      '%28'
          1        ROPE_ADD                                      1  ~6      ~6, !1
          2        ROPE_ADD                                      2  ~6      ~6, '+%2A+10+%2B+'
          3        ROPE_ADD                                      3  ~6      ~6, !2
          4        ROPE_END                                      4  ~5      ~6, '%29+Euro+and+%2810+%2B+2%29+cents'
          5        ASSIGN                                                   !0, ~5
    3     6        ASSIGN                                                   !3, '%23%5C%28%28%28%5B%5E%28%29%5D%2B%7C%28%3FR%29%29%2A%29%5C%29%23'
    4     7        INIT_FCALL                                               'preg_match_all'
          8        SEND_VAR                                                 !3
          9        SEND_VAR                                                 !0
         10        SEND_REF                                                 !4
         11        DO_ICALL                                         $11     
         12      > JMPZ                                                     $11, ->20
    5    13    >   INIT_FCALL                                               'var_export'
         14        FETCH_DIM_R                                      ~12     !4, 1
         15        SEND_VAL                                                 ~12
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $13     
         18        ECHO                                                     $13
         19      > JMP                                                      ->21
    8    20    >   ECHO                                                     !0
    9    21    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.65 ms | 1395 KiB | 17 Q