Add note about inconsistent T_* constant values across PHP versions (thanks anonymous 11741)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@318883 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nikita Popov 2011-11-07 16:12:16 +00:00
parent 7253585e65
commit 2ae783e6b5

View file

@ -13,6 +13,24 @@
know that, here is a table with those identifiers, PHP-syntax and
references to the appropriate places in the manual.
</para>
<note>
<title>Usage of T_* constants</title>
<para>
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 <constant>T_FILE</constant> constant is
<literal>365</literal> in PHP 5.3, while the same value refers now to
<constant>T_TRAIT</constant> in PHP 5.4 and the value of <constant>T_FILE</constant>
is <literal>369</literal>. 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 <literal>10000</literal>) and an appropriate strategy that
will work with both PHP versions and T_* values.
</para>
</note>
<table>
<title>Tokens</title>
<tgroup cols="3">