Ive been working some time on own template engines but i alwais get stuck in strucktured documents like
<block : block1>
<table>
<block : row>
<tr>
<td>
{value}
</td>
<td>
{value2}
</td>
</tr>
</block>
</table>
</block>
I can get "block 1" with a regex but it will break at the first (the one of "row")
But i want a smarter way (and not by using a function like DOM) i was thinking about something like
while($i < strlen($code)){
if(substr($code,$i,1)){
//tag is opened
}
}