PHP function

Discussion in 'PHP' started by hanliong, Feb 6, 2008.

  1. hanliong

    hanliong New Member

    Joined:
    Dec 21, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    I have read at many article and PHP.net itself.
    I'm very newbie with PHP. But i always see that people use php script like this:

    this->bla..bla...
    I don't know, why use "this->". What is it use for? Can you help me with simple word to explain about this?

    and many script use that arrow. Like this sample:
    PHP:
    $mail->AddReplyTo($email_reply_to_address$email_reply_to_name);
    why use ->? Can't it just mail($email_reply_to_address, $email_reply_to_name);?

    Thanks
     
    Last edited by a moderator: Feb 6, 2008
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    I guess you are not aquainted with OOP (Object Oriented Programming - http://www.go4expert.com/showthread.php?t=436), this always refers to the “owner” of the function we're executing, or rather, to the object that a function is a method of.

    In you example, $mail contains the instance of some Class/Object, and mail is a method of the Class/Object, to call the method we use the arrow (->) operator.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice