- token_get_all: documentation ( source)
- token_name: documentation ( source)
<?php
$php = '<?php $var = readonly /* commment */ ();';
foreach (token_get_all($php) as $token) {
if (is_array($token)) {
echo token_name($token[0]) . "\n";
} else {
echo $token . "\n";
}
}