- token_get_all: documentation ( source)
- token_name: documentation ( source)
<?php
$tokens = token_get_all(<<<EOF
<?php
echo "";
EOF
);
foreach ($tokens as $token) {
if (is_array($token)) {
echo "Line {$token[2]}: ", token_name($token[0]), " ('{$token[1]}')", PHP_EOL;
}
}