Doc #80772 [Opn->Csd]: edg@greenberg.org

From: Date: Thu, 18 Feb 2021 19:54:38 +0000
Subject: Doc #80772 [Opn->Csd]: edg@greenberg.org
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18568@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80772&edit=1 ID: 80772 User updated by: edg at greenberg dot org Reported by: edg at greenberg dot org -Summary: Documentation pages for tokenizer conflict with each other +Summary: edg@greenberg.org -Status: Open +Status: Closed Type: Documentation Problem Package: Unknown/Other Function Operating System: n/a PHP Version: 7.4.15 Block user comment: N Private report: N New Comment: I don't think I understood all I knew. Closing. Previous Comments: ------------------------------------------------------------------------ [2021-02-18 16:58:50] edg at greenberg dot org Description: ------------ --- From manual page: https://php.net/tokenizer.examples --- The example code conflicts (does exactly the wrong thing) with the warning on documentation page: https://www.php.net/manual/en/tokens.php wherein it is written: Note: 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80772&edit=1

« previous php.doc.bugs (#18568) next »