SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot sifuhall's Avatar
    Join Date
    Jun 2001
    Location
    out of the sidehatch
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    method reference

    How do you reference a class method from within the class?

    For example I have a class test.

    Inside class test I have method A and method B.

    I want to call method B inside method A.

    I tried:

    Code:
    function A ($somevar) {
         this->B($somevar);
    But this doesn't seem to work.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to make it $this-> not this-> notice the dollar sign. That is how you reference the class level variables and methods. Like $this->somevar or $this->methodA()
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •