#43213 [Com]: Unable to define distinct class constants

From: Date: Wed, 07 Nov 2007 16:22:11 +0000
Subject: #43213 [Com]: Unable to define distinct class constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119347@lists.php.net to get a copy of this message
ID: 43213 Comment by: carsten_sttgt at gmx dot de Reported By: uli dot staerk at globalways dot net Status: Open Bug Type: Scripting Engine problem PHP Version: 5.2.4 New Comment: You can found the answer here: http://de.php.net/manual/en/reserved.php | You cannot use any of the following words (PHP Keywords) | as constants, class names, function or method names. ("array" is one of them) Regards, Carsten Previous Comments: ------------------------------------------------------------------------ [2007-11-07 16:09:10] uli dot staerk at globalways dot net Description: ------------ You can define class constants like: class foo { const bar = "baz"; } But if the constant-name is array, it does not work. Reproduce code: --------------- <?php class Test { const Array = "array"; } ?> Expected result: ---------------- It should work ;) Actual result: -------------- Parse error: syntax error, unexpected T_ARRAY, expecting T_STRING in test.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43213&edit=1

« previous php.bugs (#119347) next »