Definition: Eval () is used to read the input string value as PHP code. Instead of reading the as a string like the Echo () function it instead reads the output as PHP code to be executed. One reason to use this is to store code in your MySQL database to pull out and execute later.
Also Known As: Evaluate String
Examples:
<?php
$name = ‘Mary’;
$name2 = ‘Ana’;
$a = ‘My friends are called $name and $name2′;
print $a . “<br>”;
eval(“\$a = \”$a\”;”);
print $a . “<br>”;
?>
This would output “My friends called are $name and $name2″ when first called with the print statement, but would output “My friends are Mary and Ana” when called the second time after running eval ()
