note 97271 deleted from function.token-get-all by danbrown
| From: | danbrown@php.net | Date: | Mon, 12 Apr 2010 14:53:01 +0000 |
| Subject: | note 97271 deleted from function.token-get-all by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168153@lists.php.net to get a copy of this message | ||
Note Submitter: paul robinson
----
Comment about the code by Dennis Robinson:
One thing to be careful about displaying tokens is that if the text you're scanning contains a
valid redirect HTML it can cause your page to redirect! When displaying I recommend a filter like
the following:
function cleanprint($buffer)
// Because the source file may contain html, we need to sanitize it
return str_replace("<", "<", $buffer);
}
Then use:
echo (cleanprint(token_name_nl($token[0]) . ': "' . $token[1] .
'"<br />'));