Req #62029 [Opn->Csd]: Allow expressions for const
| From: | requinix@php.net | Date: | Sat, 30 Aug 2014 07:57:21 +0000 |
| Subject: | Req #62029 [Opn->Csd]: Allow expressions for const | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187347@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62029&edit=1
ID: 62029
Updated by: requinix@php.net
Reported by: zyss at mail dot zp dot ua
Summary: Allow expressions for const
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: All
PHP Version: 5.3.13
-Assigned To:
+Assigned To: requinix
Block user comment: N
Private report: N
New Comment:
Added in 5.6.
Previous Comments:
------------------------------------------------------------------------
[2012-05-14 15:53:08] zyss at mail dot zp dot ua
Description:
------------
Currently PHP supports global constant definition using keyword const instead of ugly define()
function call.
The problem is that const definition doesn't allow expressions to be used to define a constant.
So please implement the ability to use expressions when using const keyword.
Test script:
---------------
<?php
const TIMEOUT = 10 * 60;
const SITE_ROOT = __DIR__;
const PAGES_DIR = '/pages/';
const PAGES_ROOT = SITE_ROOT . PAGES_DIR;
Expected result:
----------------
All constants defined.
Actual result:
--------------
Parse error: syntax error, unexpected '*', expecting ',' or ';' in
...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62029&edit=1