Should or shouldnot use eval() function to evaluates an encrypted PHP source code?

The function is eval ( string $str )

This string $str can be already decrypted from an encrypted string using Hash or bin2hex or base64.

The string passed to eval() function must be valid PHP code and must end with semicolon. You can evaluate a class, a function and a string of multiple lines of php code.

This function returns NULL unless a return statement is called in the code string. Then the value passed to return is returned. eval() returns FALSE if there is a parse error in the code string. The parser will die on the line after the eval() function call if the string is not properly escaping. In order to mix HTML output and PHP codes, you can use a closing PHP tag to leave PHP mode.

Unfortunately this eval() function is not the good way to decrypt your php codes because the pure PHP can be viewed in browser. Some intermediate programmers can easily hack the encrypted codes that use eval() function to execute php.

Note: Because this is a language construct and not a function, it cannot be called using variable functions.

For example: if you write a function like the one below and call it from another file, it won’t work.

function evaluate_this_code($pString){
eval(
$pString);
}
and pass a string to a function call like this:
evaluate_this_code($some_other_string);

It won’t work the way you expected.