diff --git a/appendices/tokens.xml b/appendices/tokens.xml index f2a7792406..8b50b9577b 100644 --- a/appendices/tokens.xml +++ b/appendices/tokens.xml @@ -13,6 +13,24 @@ know that, here is a table with those identifiers, PHP-syntax and references to the appropriate places in the manual. + + + Usage of T_* constants + + All tokens listed below are also defined as PHP constants. Their value is + automatically generated based on PHP's underlying parser infrastructure. + This means that the concrete value of a token may change between two PHP + versions. For example the T_FILE constant is + 365 in PHP 5.3, while the same value refers now to + T_TRAIT in PHP 5.4 and the value of T_FILE + is 369. This means that your code should never rely directly + on the original T_* values taken from PHP version X.Y.Z, to provide some compatibility + across multiple PHP versions. Instead your code should utilize custom values + (using big numbers like 10000) and an appropriate strategy that + will work with both PHP versions and T_* values. + + + Tokens