note 84595 added to language.oop5.constants
| From: | ae dot fxx at osu1 dot php dot net | Date: | Mon, 21 Jul 2008 09:10:53 +0000 |
| Subject: | note 84595 added to language.oop5.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142411@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 217.160.72.57
Probable Submitter: 92.229.211.75
----
Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php
Edit -- https://master.php.net/note/edit/84595
Del: integrated -- https://master.php.net/note/delete/84595/integrated
Del: useless -- https://master.php.net/note/delete/84595/useless
Del: bad code -- https://master.php.net/note/delete/84595/bad+code
Del: spam -- https://master.php.net/note/delete/84595/spam
Del: non-english -- https://master.php.net/note/delete/84595/non-english
Del: in docs -- https://master.php.net/note/delete/84595/in+docs
Del: other reasons-- https://master.php.net/note/delete/84595
Reject -- https://master.php.net/note/reject/84595
Search -- https://master.php.net/manage/user-notes.php