Page 1 of 1
executing variables
Posted: Tue Jul 29, 2003 6:58 am
by thyseus
Hi. following code:
$a = "Hello world";
$b = "echo $a";
Now i want to execute the value of $b, like
$c = EXECUTE($b);
$c should now contain "Hello World";
how do i do this?
thx
Posted: Tue Jul 29, 2003 7:01 am
by twigletmac
Why do you need this functionality? Depending on exactly what you want to do there could be a few different solutions.
Mac
Posted: Tue Jul 29, 2003 7:17 am
by thyseus
(object-oriented code)...
I want to create an sql statement like this:
$str = $newobject->strtolower($newclass) . "id";
$val = EXEC($str);
$newobject->search("id", $val);
i have a class for every table. these tables are linked.
the table of $newclass has an column that is called
"newobjectid". The id has to be added to "newobject"
this is why i need this functionality.
the "search" method build the query.
hope this helps....
Posted: Tue Jul 29, 2003 9:55 pm
by jmarcv
Try this?
$a = "Hello world";
$b = "echo $a";
$tr = fopen('tmp.inc', "w");
fputs ($tr,$b);
fclose($tr);
include 'tmp.inc';