Sunday, September 28, 2008

PHPDig.net - php - eval

From http://www.phpdig.net/ref/rn39re741.html :

eval() is used to evaluate a string as PHP code. It's most often used to execute PHP code that's built at runtime or to get around some of the limitations in the PHP parser. Use of eval() can be somewhat tricky at times. Novice programmers have suggested that evil() would be a more appropriate name for the function.

eval() behaves as if the string being evaluated was a normal block of code in the same scope as the call to eval() . The best way to explain this is by using a few simple code examples. In PHP 4, there is an exception to this rule. A return() statement can be used to stop parsing of the evaluated string. The value after the return() statement will be returned by the eval() function. The following scripts should be equivalent:

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home