- token_get_all: documentation ( source)
- print_r: documentation ( source)
<?php
$code ='<?php
function test($a) {
echo $a;
}
$a = 10;
test($a);
?>';
$tokens = token_get_all($code);
print_r($tokens);
foreach ($tokens as $row) {
//echo token_name($row[0]), "\r\n";
}