[nycphp-talk] I need help with eval() with a class void method call
soazine at pop.erols.com
soazine at pop.erols.com
Thu Oct 9 17:30:55 EDT 2003
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
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
More information about the talk
mailing list