What is the error in the script?

Everything is OK:
$a = 'output';
eval("echo \"$a\";");

$a = 'output';
eval("echo $a;");

Notice: Use of undefined constant output - assumed 'conclusion' in ...test.php(5) : eval()'d code on line 1

Where he sees a constant? OK, will do:
$a = '\'withdrawal\";
eval("echo \"$a\";");

On the screen 'conclusion' (with quotation marks).
So PHP it has to be like in echo 'output'; and then on the screen the word without quotation marks should be shown?
June 8th 19 at 17:29
1 answer
June 8th 19 at 17:31
$a = 'output';
eval("echo $a;");

All logically correct, PHP searches for variables in double quotes and of course framing values.

eval("echo output");

It's like this:

$a = 'output';
eval('echo $a;');

Find more questions by tags PHP