jsimmons Posted March 24, 2006 Share Posted March 24, 2006 I tried to add a function to a class and I get an error sayng the function isn't defined when I call the function from within the same class. The function is most certainly there. Is there something more to adding a function to a class than, ummm, adding it? Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 24, 2006 Share Posted March 24, 2006 [!--quoteo(post=357889:date=Mar 24 2006, 11:34 AM:name=jsimmons)--][div class=\'quotetop\']QUOTE(jsimmons @ Mar 24 2006, 11:34 AM) [snapback]357889[/snapback][/div][div class=\'quotemain\'][!--quotec--]I tried to add a function to a class and I get an error sayng the function isn't defined when I call the function from within the same class. The function is most certainly there. Is there something more to adding a function to a class than, ummm, adding it?[/quote]are you referering to it properly? even tho it's in the same class, you still have to refer to it, for example ,like:[code]$this->myfunction();[/code][b]EDIT:[/b] to clear up, $this is used to referer to any of a classes objects from within, including variables. it doesnt matter what the class is called, you still use $this when refering to something from within.hope that works 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.