|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75330 Incorrect word choice
Submitted: 2017-10-06 23:36 UTC Modified: 2017-10-08 01:59 UTC
From: danielklein at airpost dot net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-10-06 23:36 UTC] danielklein at airpost dot net
From manual page:
Example #3 token_get_all() on a class using a reserved word example


$source = <<<'code'

class A
    const PUBLIC = 1;

$tokens = token_get_all($source, TOKEN_PARSE);

foreach ($tokens as $token) {
    if (is_array($token)) {
        echo token_name($token[0]) , PHP_EOL;
The above example will output something similar to:


Without the TOKEN_PARSE flag, the *penultimate* token (T_STRING) would have been T_PUBLIC.


The word "penultimate" is incorrect here. "penultimate" means "second to last", therefore it refers to "A", not "PUBLIC". While "ultimate" is more accurate, the word "last" or "final" would be a better choice here.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-07 00:09 UTC] danielklein at airpost dot net
I just realised it means "the last of all the tokens", not "the last T_STRING token". I think it would be better as "the last T_STRING token" or "the second T_STRING token".
 [2017-10-07 00:25 UTC]
-Status: Open +Status: Not a bug
 [2017-10-07 00:25 UTC]
Thank you for taking the time to write to us, but this is not
a bug

Imo it's clear as it is as it's (T_STRING) in parentheses.
 [2017-10-08 01:12 UTC] danielklein at airpost dot net
I totally agree. If English is your first language and you already know what the sentence means, it's perfectly clear.

However, I'm a busy programmer with deadlines to meet and I don't always have time to examine every nuance of every sentence. I misunderstood the sentence long enough to write a bug report about it, and it took me half an hour to realise that it was already *technically* correct.

Making it clearer would benefit everybody. Alternatively, you could comment it! After all, that's what we do with unclear code!
 [2017-10-08 01:59 UTC]
I am sorry, but not having time to read sentences is not a compelling reason for me. As such I am not convinced it needs to be changed.

Thanks again for taking the time to write to us.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Feb 27 10:01:24 2021 UTC