- token_get_all: documentation ( source)
- token_name: documentation ( source)
- hrtime: documentation ( source)
<?php
$start=hrtime(true);
$code = '<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");';
$tokens = token_get_all($code);
foreach ($tokens as $token) {
if (is_array($token)) {
echo "Line {$token[2]}: ", token_name($token[0]), " ('{$token[1]}')", PHP_EOL;
}
}
$end=hrtime(true);
$eta=$end-$start;
echo $eta/1e+6; //nanoseconds to milliseconds