Re: [PHP4BETA] eval'ing a method

From: Date: Sat, 06 May 2000 05:21:37 +0000
Subject: Re: [PHP4BETA] eval'ing a method
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-14572@lists.php.net to get a copy of this message
Mitch Vincent wrote: > ... > Perhaps you should have posted the idea or what you wanted to get > accomplished and taken ideas from what people have say. So... I take it you > want to store actual PHP code in a database and yank it out / execute it > accordingly? Great question! Try it! I felt I was stretching it by posting what I did, but some of the best (for me) messages I've seen here have been other peoples problematic code snippets. Some functions exist that are not documented in the online manual yet. . if I could view the complete PHP symbol table I probably would not have had to ask the question <cough>. . it illustrates again (with Faisals' answer) that required, included and eval'd code is gonna end up globally scoped, period :-( . yes, I would like to store the method() that renders to HTML other data stored in the same and related records so that the scripted PHP code is just a generic engine to deal dynamically with specific instances of raw_data->HTML rendering. Below is getting there; <?php class blah { function somemethod() { eval('class xxxx { function somefunc() { return "wherethefsckami"; }}'); $this->beer = new xxxx; } } $x = new blah; $x->somemethod(); echo "x->beer->somefunc()=".$x->beer->somefunc()."<br>\n"; ?> Thank you Faisal ! --markc

« previous php.version4 (#14572) next »