eval is evil!

June 12th, 2007

“eval is evil!”—at least this is what you get told always (and I don’t disagree, btw). So I’m a bit surprised to see something like this

eval("parent::__construct(" . join(',',
    array_map('add_single_quotes', $args)) . ");");
at devzone.zend.com

I don’t think there is a (security) problem with this code because of eval() usage, but why use eval() at all if there are better alternatives (call_user_func_array() in this case)?

1 Response to “eval is evil!”

  1. Patrick Says:

    the evilness of eval is equal to the madness of the programmer.

Leave a Reply