const in php doesn't work

hero080

New Member
Messages
16
Reaction score
0
Points
0
I have defined a class like:
PHP:
class MyClass {
  public const AAA = 10;  // doesn't work here
  public const BBB = 100;
  // some other methods
}
The script halted when it comes to the line of
Code:
public const AAA = 10;
Can anybody give me a clue "why"?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Not 100% sure, but I don't think a const can take a visibility modifier. ie, drop the 'public'
 

hero080

New Member
Messages
16
Reaction score
0
Points
0
I don't think so. The visibility should apply to any field/method. And I tried to remove it, it shows the same error.

A quick quesition. Is x10hosting providing php5 support or earlier version?
 
Top