Re: [RFC] Normalize token_get_all() output (with flag)
| From: | Stanislav Malyshev | Date: | Tue, 05 Jan 2016 00:21:24 +0000 |
| Subject: | Re: [RFC] Normalize token_get_all() output (with flag) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-90018@lists.php.net to get a copy of this message | ||
Hi!
> https://wiki.php.net/rfc/token-get-always-tokens
>
> This should be pretty non-controversial. I hope?
No way!
Just kidding :) I think it's a great idea, token_get_all() is annoying
to deal with. We'd have to fix token_name though so that this would
still work:
foreach ($tokens as $token) {
if (is_array($token)) {
echo "Line {$token[2]}: ", token_name($token[0]), "
('{$token[1]}')", PHP_EOL;
}
}
We could, of course, do something like
$token[0]<=255?$token[0]:token_name($token[0]) - but that looks hacky.
--
Stas Malyshev
smalyshev@gmail.com