3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = '(2+3-4*2(1+1-2)+(2+2)-3+4+2-5*4+2*(1+1))+2+(1+1)'; preg_match_all("/\((([^()]*|(?R))*)\)/",$string,$matches); var_dump($matches);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(3) { [0]=> array(2) { [0]=> string(40) "(2+3-4*2(1+1-2)+(2+2)-3+4+2-5*4+2*(1+1))" [1]=> string(5) "(1+1)" } [1]=> array(2) { [0]=> string(38) "2+3-4*2(1+1-2)+(2+2)-3+4+2-5*4+2*(1+1)" [1]=> string(3) "1+1" } [2]=> array(2) { [0]=> string(0) "" [1]=> string(0) "" } }