Jump to content


Photo

Undefined function


  • Please log in to reply
1 reply to this topic

#1 jsimmons

jsimmons
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 24 March 2006 - 11:34 AM

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?



#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 24 March 2006 - 11:47 AM

[!--quoteo(post=357889:date=Mar 24 2006, 11:34 AM:name=jsimmons)--][div class=\'quotetop\']QUOTE(jsimmons @ Mar 24 2006, 11:34 AM) View Post[/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:

$this->myfunction();

EDIT: 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
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users