note 84595 rejected from language.oop5.constants by colder
| From: | colder@php.net | Date: | Mon, 21 Jul 2008 11:57:04 +0000 |
| Subject: | note 84595 rejected from language.oop5.constants by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142417@lists.php.net to get a copy of this message | ||
Note Submitter: ae.fxx
----
Hi there.
For those of you that are desperately searching a way to dinamically add class constants during
runtime:
Consider using the PECL extension >> runkit.
DLLs can be found here: http://pecl4win.php.net/ext.php/php_runkit.dll
Just drop the file into your php\ext folder and update your php.ini to load it. Then restart your
server and you're set.
A small example:
<?php
class Test {
constant X = 'Hello';
constant Y = 'World';
....
}
runkit_constant_add('Test::HELLO', X.' '.Y.' !!!');
echo Test:HELLO; // Outputs: Hello World !!!
?>
Voila.