The beauty of string parsing, parting shot
Did you know that {$array} is tokenized as
<?php
array (
0 => 'T_CURLY_OPEN',
1 => '{',
),
array (
0 => 'T_VARIABLE',
1 => '$array',
),
'}',
?>however ${array} gets parsed into
<?php
array (
0 => 'T_DOLLAR_OPEN_CURLY_BRACES',
1 => '${',
),
array (
0 => 'T_STRING_VARNAME',
1 => 'array',
),
'}',
?>and then any { outside of strings is tokenized into the literal character {. In other words, there are three different tokens for the opening curly brace but there is only one token for the closing one.

Comments
the
the T_DOLLAR_OPEN_CURLY_BRACES isn't a token for just the opening curly brace , but for ... you know, nevermind, it's right there in the name.
that does not matter
if you try to find the matching pairs of { } it wont help you that a $ is stuck to {. I am complaining about you need to check three different tokens to get all { but only one to get all } -- that's just not right.
Post new comment