Moguce je, koristeci
eval() funkciju.
Code:
$nesto = 1;
$proba = 0;
if ($nesto == 1) {
$uslov = "return($proba == 0);";
} else {
$uslov = "return($proba != 0);";
}
if (eval($uslov)) {
print "proba je nula";
}
Zasto
return, mozda se pitas ti? Evo zasto:
Citat:
A return statement will terminate the evaluation of the string immediately. In PHP 4, eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. In PHP 3, eval() does not return a value.
Pozdrav,
alex.
Alex: My favorite site is
http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x