3v4l.org

run code in 500+ PHP versions simultaneously
<?php $code = '<?php class Foo { public const NEW = Bar::NEW; }'; foreach (token_get_all($code, TOKEN_PARSE) as $t) { if (is_array($t) && strcasecmp($t[1], 'new') === 0) { echo token_name($t[0]), ' [', $t[1], ']', PHP_EOL; } }
Output for 8.3.0 - 8.3.33, 8.4.1 - 8.4.25, 8.5.0 - 8.5.10
T_NEW [NEW] T_STRING [NEW]
Output for 8.2.31 - 8.2.33
T_STRING [NEW] T_STRING [NEW]

preferences:
39.62 ms | 786 KiB | 4 Q