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:
367.68 ms | 405 KiB | 5 Q