SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: What is ".="

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is ".="

    Hi,

    I was reading about PHP tutorial online. What does ".=" mean? How is it used?

    Thanks for the answers in advance.

    jozin

  2. #2
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Raleigh, NC
    Posts
    783
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add to the end of a var. ex:
    PHP Code:
    $a "hello";
    $a .= " ";
    $a .= "world";
    echo 
    $a;
    // echos: hello world 

  3. #3
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    As demonstrated above it allows you to concatinate two strings together with the string on the left coming first. The following two lines are equivalent:

    $string1 = $string1 . $string2;

    $string1 .= $string2;

  4. #4
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    sea ranch
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's just a little shortcut to make your code shorter and cleaner. You'll notice things like this in almost any major language you learn.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks for the info.

    Hi guys,

    Thanks a lot. Your answers are not always found in some tutorials.

    jozin


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
  •