[Solved] Php Variable as conditional assignment with eval() [duplicate]


You’re missing return and a semicolon.

But really, you should avoid eval.

<?php
$foo = 1;
$bar = 2;
$test=" && $bar == 2";
if(eval('return $foo == 1' . $test . ';')) {
    echo "That horribly eval()'d code worked!";
}
?>

solved Php Variable as conditional assignment with eval() [duplicate]