Re: PHP and case-sensitivity inconsistency in PHP 6

From: Date: Mon, 27 Jan 2014 15:57:01 +0000
Subject: Re: PHP and case-sensitivity inconsistency in PHP 6
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-71640@lists.php.net to get a copy of this message
On 27 January 2014 11:05, Alain Williams <addw@phcomp.co.uk> wrote: > On Sun, Jan 26, 2014 at 03:36:08PM -0800, Stas Malyshev wrote: > * there are a few special values that are currently case insenitive, eg: > NULL, TRUE. > I would suggest that they only be recognised in upper case, eg: null > would be > invalid. This fits with the meme of constant names being in upper case. > Why would you want FUNCTION tellMeEverythingIsOk(){ ECHO TRUE; } to work but not function tellMeEverythingIsOk(){ echo true; } ?? true/false/null aren't constants, they're language constructs like 'array' and 'callable' (and arguably 'function') - or at least they're part of the same group (base types) and would expect them to have the same case conventions. I wouldn't think anyone would want to enforce $var = ARRAY( 'foo' ); on the PHP world. If we're enforcing case sensitivity with the true/false/null keywords, I'd expect 'true' to be the primitive type, 'TRUE' to be a constant that someone could define for some dubiously-sensible purpose (like having the value needed to be set in some database), and 'True' to be a class that someone could define for a slightly more sophisticated purpose ($t = new True(); try { $db->set( 'field', $t->getForDatabase() ); } catch { echo "Could not set field to {$t->getHumanReadable()} ). But I don't see any reason to make true/false/null case sensitive (whichever canonical casing you then choose) in the first place. G

« previous php.internals (#71640) next »