token_get_all
PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
token_get_all - Split given source into PHP tokens
Example #1 token_get_all example
Result: Line 1: T_OPEN_TAG ('<?php ')
Line 1: T_ECHO ('echo')
Line 1: T_WHITESPACE (' ')
Line 1: T_CLOSE_TAG ('?>')
Example #2 token_get_all incorrect usage example
Result: Line 1: T_INLINE_HTML ('/* comment */')
Example #3 token_get_all on a class using a reserved word example
Result: T_OPEN_TAG
T_WHITESPACE
T_CLASS
T_WHITESPACE
T_STRING
T_CONST
T_WHITESPACE
T_STRING
T_LNUMBER