note 46382 deleted from function.eval by googleguy
| From: | googleguy@php.net | Date: | Fri, 24 Feb 2017 21:09:52 +0000 |
| Subject: | note 46382 deleted from function.eval by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208814@lists.php.net to get a copy of this message | ||
Note Submitter: mahaixing at hotmail dot com
----
When using Dynamic Proxy design pattern we must create a class automaticly. Here is a sample code.
<?php
$clazz = "class SomeClass { var \$value = 'somevalue'; function show() { echo
get_class(\$this);}}";
eval($clazz);
$instance = new SomeClass;
// Here output 'somevalue';
echo $instance->value;
echo "<br>";
//Here output 'someclass'
$instance->show();
?>