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