Good morning all: When calling functions from the *global* namespace, the PHP parser creates opcodes that use those functions directly. When those functions are certain built-in functions, the parser can use special opcodes that are optimized for those function calls.
When calling functions from *within* a namespace, the parser does not know at compile time if the function is defined in the current namespace or if the global function will be used. Because unqualified function calls are ambiguous, the parser adds an NS Lookup opcode which performs a runtime check for the function name in the current namespace, and then falls back to the global namespace if the function is not defined locally. This also prevents the parser from using dedicated opcodes for built-in functions. This incurs a performance penalty. In the past, RFCs that aimed to address this issue got too hung up on a syntax discussion, rather than a simple “should we solve this” question proposed to the community. I would like to discuss and then vote on this proposal as a feature, without getting into any specifics of syntax. I propose that we vote yes/no on if there should be some way, whatever that way ends up being, to tell the parser to always treat unqualified function names as global. I think it's important to get a “clean vote” on this issue, to separate out if past objections were objections to the concept, or if only the syntax proposed in past discussions was disfavored. To that end, I have created the following RFC: https://wiki.php.net/rfc/global_function_parser_directive I am asking that we discuss and vote on the following question: “Should there be some way for developers to signal to the parser at compile time that all unqualified function names found in a namespace context are global, without a namespace lookup?” Yes: We should do this, let's discuss syntax possibilities. No: This should not be a feature at all. Thank you for your consideration.