note 66870 deleted from language.oop5.constants by danbrown

From: Date: Wed, 03 Aug 2011 13:30:14 +0000
Subject: note 66870 deleted from language.oop5.constants by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182181@lists.php.net to get a copy of this message
Note Submitter: ---- In addition to what "tobias_demuth at web dot de" wrote: Assigning the return value of a function to a constant does not work. Thus you may assign the return value of a function to a global constant defintion using "define()" and assign this global constant to the class constant. The following example works as expected. <?php define("MYTIME", time()); class test { const time = MYTIME; } print test::time; ?> Will output the current timestamp. Whatsoever: IMHO this is "bad style" and so I suggest NOT to use this as "workaround".

« previous php.notes (#182181) next »