Valect Posted November 11, 2007 Share Posted November 11, 2007 I've been trying to pass a function name to a variable to store it and run it later.. here's a snippet: $this->timer(1,"ping",$this->action->ping(),REPEAT); Not putting "$this->action->ping()" in quotes runs it, however putting it in quotes results in the error: Catchable fatal error: Object of class actions could not be converted to string... function timer($wait,$name,$what,$repeat) { $this->holder['timer'][$name]['runtime'] = time() + $wait; $this->holder['timer'][$name]['interval'] = $wait; $this->holder['timer'][$name]['execTimer'] = $what; $this->holder['timer'][$name]['repeat'] = $repeat } Later in the script is the line to run the function... $this->holder['timer'][$name]['execTimer']; I've tried serizlization and some other methods.. I think I'm just going about this all wrong. Any ideas? Quote Link to comment Share on other sites More sharing options...
kratsg Posted November 11, 2007 Share Posted November 11, 2007 Why do you have $this->action->ping()? What is the 'action' part of it? If you're calling it within the same class, you just need $this->ping() Quote Link to comment Share on other sites More sharing options...
Valect Posted November 11, 2007 Author Share Posted November 11, 2007 it's another class... $this->action = new actions(); Just the way I set it up, not really relevant to what I'm trying to do Quote Link to comment Share on other sites More sharing options...
Valect Posted November 11, 2007 Author Share Posted November 11, 2007 Any other ideas? I'm really at a loss here. Quote Link to comment Share on other sites More sharing options...
Valect Posted November 11, 2007 Author Share Posted November 11, 2007 I solved this with eval("$".$this->holder['timer'][$name]['execTimer'].";"); and by setting it with $this->timer(1,"ping",this->action->ping(),REPEAT); Took me a good 6 hours to figure out, hope someone else benefits from this >.< Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.