Adisory: userinput + eval = security hole;
Also, eval is an expensive operation that requires parsing a string in an executable format (a parsing tree, an abstract syntax tree, etc.) and executing a new found logic.
You do not want to analyze every little thing in the code. Use eval if you have something for this to chew on, or rather put this logic somewhere where it is reused and parameterized, for example, a function.
As well as php 5.4
$method = array('class_name', 'method_name'); $method();
source share