note 52214 added to language.oop5.constants
| From: | tobias_demuth at web dot de | Date: | Sun, 24 Apr 2005 17:39:32 +0000 |
| Subject: | note 52214 added to language.oop5.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88498@lists.php.net to get a copy of this message | ||
Please note, that it is not possible to initialize an object's constant with a not-constant
value. Something like this won't work:
<?php
class Testing {
const TIME = time();
// Some useful code
}
echo Testing::TIME;
?>
It will break with: Parse error: syntax error, unexpected '(', expecting ',' or
';' in path/to/file on line anylinenumber
Hope this will help somebody...
----
Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52214
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52214&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52214&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52214&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52214&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52214&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52214&report=yes
Search -- http://master.php.net/manage/user-notes.php