4 ms·
Using '\' as a namespace seperator? Just off the top of my head, there are probably loads more.
by ainsomni 14y ago
Using '\' as a namespace seperator? Just off the top of my head, there are probably loads more.
- TheBoff 14y agoWhat makes that explicitly bad?
- wvenable 14y agoI've actually gotten used to it (and I rallied against it heavily). It's really not so bad; it's even somewhat nice it has a file-system like connotation. PHP's design precluded using any existing operators.
- swivelmaster 14y agoBased on how long it took to introduce the ability to say foo()["bar"], I'm guessing it's not the language so much as it's a set of poorly designed parser rules. Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result);
- wvenable 14y ago> I'm guessing it's not the language so much as it's a set of poorly designed parser rules. There are poorly designed parser rules but the namespace operator is not due to that. It's due to the fact that a single PHP file will be compiled to byte code without knowing what the symbols represent until runtime. The separate operator is needed because names are resolved before execution begins and before the symbols are known. > Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result); Empty is identical to the not (!) operator except that empty() can operate on undefined variables, undefinted array keys, or undefined properties. empty(functionResult()) doesn't make any sense because functionResult() can never be an undefined variable. You just use !functionResult().