note 24181 added to keyword.paamayim-nekudotayim
| From: | jdominic at prodigy dot net | Date: | Thu, 08 Aug 2002 16:49:27 +0000 |
| Subject: | note 24181 added to keyword.paamayim-nekudotayim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34539@lists.php.net to get a copy of this message | ||
According to the documentation, there is no way to have a class variable, only class functions.
There should be class variables, because there's no way to implement CONSTANTS. Something like
this won't work:
<?
class Employee {
var $ACTIVE_EMPLOYEE = 1;
//etc..
}
echo Employee::ACTIVE_EMPLOYEE;
//Also tryed:
echo Employee::$ACTIVE_EMPLOYEE
?>
returns:
Parse error: parse error, unexpected ';', expecting '(' in
/home/x/public_html/Test.php on line 9
It forces you to create an instance of the class:
$emp = new Employee();
echo $emp->ACTIVE_EMPLOYEE;
--
http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php
http://master.php.net/manage/user-notes.php?action=edit+24181
http://master.php.net/manage/user-notes.php?action=delete+24181
http://master.php.net/manage/user-notes.php?action=reject+24181