This is ok:
<?php
define ("HOME_BTN", "Home");
class Menu
{
}
?>
This is not
<?php
class Menu
{
define ("HOME_BTN", "Home");
}
?>
It won't let me define a constant class member.
(gives a parse error on the define line)
Why?
define constants in class
Moderator: General Moderators
- EvilWalrus
- Site Admin
- Posts: 209
- Joined: Thu Apr 18, 2002 3:21 pm
- Location: Springmont, PA USA
Class constants are available in PHP5, but not in PHP4...
Code: Select all
<?php
class foo
{
public const bar = 'baz';
...
}
?>-
allelopath
- Forum Commoner
- Posts: 34
- Joined: Tue Mar 16, 2004 5:21 am