I have this line in my code:
eval('$field->' . $val . '(' . $max . ',' . $errDisplayArray[$key] .
');');
where $field is a predefined class instance, $val is a string
containing the name of an existing method within the class, and
$errDisplayArray[$key] will be an array element containing text that
goes appropriately into the class method whose name is in $val.
Whenever I run this I get a parse error, however, upon using a die()
statement instead of eval it configures as so (and works!):
$field->setMaxLength(40,"The last name cannot be more than 40
characters");
when I insert this line verbatim into my code I receive no breakage of
any kind upon that line. I have read the eval() statement all over
php.net, phpbuilder, phpfreaks and zend and I can't see what I'm doing
wrong. Could someone clarify it for me?
Thanx
Phil