Re: [PHP4BETA] eval'ing a method
| From: | Faisal Nasim | Date: | Fri, 05 May 2000 18:22:52 +0000 |
| Subject: | Re: [PHP4BETA] eval'ing a method | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14548@lists.php.net to get a copy of this message | ||
| Just a comment, I don't know in theory if this will work, I really doubt
it
| will as-is.. I see some problems with scope and special characters that I
| won't get into..
If you looked at this for a moment, you would understand exactly
what he is asking for! And he gave the error showing that it wasn't
working and if there is a possible workaround to that (see other
message).
| Still. People posting actual code here and asking if it works seems a bit
| silly to me. Try it! Then you'll KNOW if your code works! Someone once
told
He tried it!
<cut>
| > I this possible ? ($m is really coming from an SQL lookup)
| >
| > <?php
| > class blah {
| > var $somevar = 1;
| >
| > function somemethod() {
| > $m = "function somefunc() { $this->somevar = 2; }";
| > eval($m);
| > $this->somefunc();
| > echo "this->somevar=$this->somevar<br>\n";
| > }
Enjoy!
Faisal