Jump to content

Undefined function


jsimmons

Recommended Posts

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?

Link to comment
Share on other sites

[!--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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.