Re: Variable method
| From: | Steve Edberg | Date: | Fri, 19 Jan 2001 04:59:40 +0000 |
| Subject: | Re: Variable method | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35560@lists.php.net to get a copy of this message | ||
At 4:53 PM -0800 1/18/01, Blaine Grady wrote:
Suppose I have:Did you think of class foo { function bar() { $method = 'doIt'; $this->$method('yes'); } function doIt($Answer) { echo "Noodles are happy? $Answer"; } } It's been awhile, but I believe that should work. If not, give us more info: What version of PHP? What, exactly, DID you try? - steve -- +--- "They've got a cherry pie there, that'll kill ya" ------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+$method = "doIt";inside a class. How do I construct the statment, using $method, to call:$this->doIt();I tried every combination I can think of but I keep getting "Call to unsupported or undefined function" when doIt() is a proper method. I have no problem with standard functions. Thanks for any help.