The eval () function calculates the string according to the PHP code.
The string must be a valid PHP code and must end with a semicolon.
If no return statement is called in the code string, NULL is returned. If there is a parsing error in the code, the eval () function returns FALSE.
For Example:
classPass{private$var1; private$var2; publicfunction__construct($var1,$var2){$varchar="this is a construct function,is hava two varchar $var1 and $var2"; eval("\$varchar=\".$varchar.\";"); echo$varchar; } } $P=new Pass("HELLO""WORLD");
Output Result:
This is a construct function,is Hava and the varchar HELLO and world.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the PHP eval function, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.