How to use php to get inside nested braces?

example:

```
{{ text1 {{text2 text3 {{text4}} text5}} }}

```

should output 

```
1- text1 {{text2 text3 {{text4}} text5}}
2- text2 text3 {{text4}} text5
3- text4

```