- var_dump: documentation ( source)
- token_get_all: documentation ( source)
- token_name: documentation ( source)
<?php
$tokens = token_get_all('<?php $a = 1 + 2; echo $a ?>');
var_dump($tokens);
foreach($tokens as $token) {
echo token_name($token[0]);
}