#33353 [Opn->Bgs]: update 'const' to allow a calculated value, like define()
| From: | tony2001@php.net | Date: | Mon, 03 Apr 2006 11:59:18 +0000 |
| Subject: | #33353 [Opn->Bgs]: update 'const' to allow a calculated value, like define() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95277@lists.php.net to get a copy of this message | ||
ID: 33353
Updated by: tony2001@php.net
Reported By: joe at bigeasy dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: linux 2.6.11
PHP Version: 5.0.4
New Comment:
Duplicate of bug #30177.
Previous Comments:
------------------------------------------------------------------------
[2005-06-15 16:16:32] joe at bigeasy dot com
Description:
------------
similar to bug request 31554, http://bugs.php.net/bug.php?id=31554
can const be modified to be assigned output from an expression, similar
to the define() function?
Reproduce code:
---------------
define( 'TEST1', 3+3); //works
class devil {
const TEST2 = 3+3; //parse error unexpected '+'
const TEST3 = (3+3); //parse error unexpected '('
public function __construct() {
echo TEST1;
echo self::TEST2;
echo self::TEST3;
}
}
$obFoo = new devil();
Expected result:
----------------
666
Actual result:
--------------
Parse error: parse error, unexpected '+', expecting ',' or ';'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33353&edit=1