Php Coding Question
Hello All,
I am writing some php code where I have a string that I want to be evaluated by php. This is a very simplified example of what I am trying to do on a larger scale, I am just wondering if this is possible:
function getSomeNum()
{
return "23";
}
$funkvar = "getSomeNum()";
echo $funkvar;
Instead of it literally echoing the string: getSomeNum()
I would like it to echo the result of the actual function getSomeNum() or 23.
Is there a way to tell php to evaluate a string,like echo eval($funkvar) and have it give me the result of getSomeNum() which is 23 instead of the literal string "getSomeNum()"?
Some way to make: echo $funkvar and echo getSomeNum() both result in 23;
Instead of echo getSomeNum() = 23
and echo $funkvar = getSomeNum()
Thanks!
-Karl
Last edited by joelhop; 08-11-2006 at 10:49 AM.
|