3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "hello[/name/hello[/second]][/bye]"; if (preg_match_all('/\[((?:[^\[\]]*|(?R))*)\]/', $pattern, $matches)) { print_r($matches); }

preferences:
19.43 ms | 402 KiB | 5 Q