SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast konsama's Avatar
    Join Date
    Jun 2007
    Location
    Sweden
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Explain this plz::: $this->from[$frmName]=$frmAddress;

    Code:
        function SignUp (&$db,$listener,$frmName,$frmAddress,$subj,$msg,$html) {
            $this->db=&$db;
            $this->listener=$listener;
            $this->from[$frmName]=$frmAddress;
            $this->subject=$subj;
            $this->message=$msg;
            $this->html=$html;
        }
    In a class file named SignUp.php there's this code that deals with variables for use with another class called phpMailer.
    Most of those variables is defined and explained at the top of the SignUp.php but I don't see any defined variables for $frmName and $frmAddress.
    All I see is $from at the top of the SignUp.php.

    Can you explain that highlighted code and how to say/think that code in human words. I think it's very weird written I don't see the logic?
    So far I know that $this-> is just something to ignore when thinking in human words.

    For example "message" part is the defined variable and "= $msg" is nickname for that variable.
    But this setup is really confusing. How do I say/think this line in human wordings?
    $this->from[$frmName]=$frmAddress;

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you have here is a class variable that is an associative array. It seems like it's trying to identify addresses according to the name of an html form. So:

    $this (instantiated class object reference) -> (access a property of the object) from (named from) [$frmName] (and access a value of form using an associative array key that is the value of $frmName) = $frmAddress (and set it to the value of $frmAddress)

  3. #3
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the PHPMailer documentation. This value is to set a name next to the from email, which you will see with many email messages. It's likely you also have an email client that does this as well. The name next to the email tends to help with some spam filters.

  4. #4
    SitePoint Enthusiast konsama's Avatar
    Join Date
    Jun 2007
    Location
    Sweden
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tnx for the explanations.


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
  •