php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32842 Constants cannot have visibility modifiers
Submitted: 2005-04-26 15:13 UTC Modified: 2006-04-03 13:43 UTC
From: rael at grad dot icmc dot usp dot br Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.0.4 OS: Windows XP Professional with SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rael at grad dot icmc dot usp dot br
New email:
PHP Version: OS:

 

 [2005-04-26 15:13 UTC] rael at grad dot icmc dot usp dot br
Description:
------------
In a class, a constant cannot have visibility modifiers.
This is weird. In other languages, like Java, constants can be public or private, etc.


Reproduce code:
---------------
<?
class MyClass{

	private const foo = "foo";

}
?>

Expected result:
----------------
No runtime errors.

Actual result:
--------------
Parse error: syntax error, unexpected T_CONST, expecting T_VARIABLE in D:\Develop\www\teste\const.php on line 4

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-03 13:43 UTC] tony2001@php.net
Duplicate of bug #27022.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Mar 24 09:00:01 2026 UTC