I am learning PHP. I see a code including "eval" below:
<?php
$name = 'cup';
$string = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "\n";
eval("\$cup = \"$str\";");
echo $cup. "\n";
?>
My question is about "\$cup = \"$str\";"
. Why do I have to use \
, "
and ;
to run the above code? Simply eval($cup = $str)
gives me error.