Jump to content

Undefined function


jsimmons

Recommended Posts

[!--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
Link to comment
https://forums.phpfreaks.com/topic/5679-undefined-function/#findComment-20233
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.