Friday, August 2, 2013

php - Unexpected $end in eval()'d code [Solve]

why we geting this error :  "Unexpected $end in eval()'d code" or "Parse error: syntax error, unexpected $end" or any syntax related error
because we just execute the statement not print the statement. ok lets check the statement
$ss="myclass::".$method_name.'()';
eval($ss);
if we execute the program it ll give the error because the statement ll come like this

myclass::function1() but you eval() method doing execute the php code not print the statement.

so we need to correct into eval() the PHP statement like myclass::function1(); in here ";" semicolon is missed that why the error. i think you got my point

No comments:

Post a Comment