note 50721 deleted from function.token-get-all by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 10:16:18 +0000 |
| Subject: | note 50721 deleted from function.token-get-all by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196960@lists.php.net to get a copy of this message | ||
Note Submitter: bertrand at toggg dot com
----
If you want to retrieve the PHP blocks then you will count up the opening curly braces '{'
and down the closing ones '}' (counter zero means block finished)
CAUTION: the opening curly braces token can take 3 values:
1) '{' for all PHP code blocks,
2) T_CURLY_OPEN for "protected" variables within strings as "{$var}"
3) T_DOLLAR_OPEN_CURLY_BRACES for extended format "${var}"
On the other hand, closing token is allways '}' !
So counting up must take place on the 3 tokens:
'{' , T_CURLY_OPEN and T_DOLLAR_OPEN_CURLY_BRACES
Have fun with PHP tokenizer !