- array_map: documentation ( source)
- var_dump: documentation ( source)
- token_get_all: documentation ( source)
- trim: documentation ( source)
- token_name: documentation ( source)
- sprintf: documentation ( source)
<?php
$tokens = token_get_all(<<<EOP
<?php
echo strpos('Hello World', 0, -5).'Wouter';
EOP
);
var_dump(array_map(function ($token) {
return sprintf('Regel %d %s %s', $token[0], trim($token[1]), token_name($token[2]));
}, $tokens));