Req #67455 [NEW]: Allow dynamic expression for const
| From: | hacksmw at naver dot com | Date: | Mon, 16 Jun 2014 17:15:30 +0000 |
| Subject: | Req #67455 [NEW]: Allow dynamic expression for const | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186213@lists.php.net to get a copy of this message | ||
From: hacksmw at naver dot com
Operating system:
PHP version: 5.6.0beta4
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Allow dynamic expression for const
Description:
------------
In PHP 5.6, const supports static expression.
But it still does not support dynamic expression.
So please implement the ability to use dynamic expressions when using
const.
I think that const should replace define() entirely.
const is much more readable and natural than define().
Test script:
---------------
<?php
const PI = atan(1)*4;
const RANDOM = rand();
echo PI . "\n";
echo RANDOM . "\n";
Expected result:
----------------
3.141592653589793
445
Actual result:
--------------
Parse error: syntax error, unexpected '(', expecting ',' or ';' in
C:\Users\hack
s_000\Desktop\test.php on line 2
--
Edit bug report at https://bugs.php.net/bug.php?id=67455&edit=1
--