MasterACE14 Posted June 16, 2009 Share Posted June 16, 2009 Hello, I have a class and 2 methods, the first method I want it to be recursive within itself. This works fine for the method as a standalone function not in a class. But I have no idea how to make it recursive when it is within the class. like for example(very poor example)... function hello($arg=null) { $arg = "Hello"; hello($arg); } // without class however how can I do the same within a class like... class something { public $arg; function hello($arg=null) { $arg = "Hello"; hello($arg); } } $obj = new something; $obj->hello(); thanks in advance. ACE Link to comment https://forums.phpfreaks.com/topic/162370-solved-oop-call-method-within-itself/ Share on other sites More sharing options...
Zane Posted June 16, 2009 Share Posted June 16, 2009 $this->hello($arg); Link to comment https://forums.phpfreaks.com/topic/162370-solved-oop-call-method-within-itself/#findComment-856986 Share on other sites More sharing options...
MasterACE14 Posted June 16, 2009 Author Share Posted June 16, 2009 works! thank you! Link to comment https://forums.phpfreaks.com/topic/162370-solved-oop-call-method-within-itself/#findComment-856989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.