Whats the difference between...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
EXDev
Forum Newbie
Posts: 7
Joined: Sun Feb 23, 2003 9:05 am

Whats the difference between...

Post by EXDev »

Hi,
anyone can show me the difference between
$foo .="some string or $variable"
and
$foo = "some sting or $variable"
i've seen ppl use the first one in some tutorial page but didn't explain the different between them, hope some expert here could help me out.
Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

  • There are some shortcuts for assignment in php (like in C)
  • $a+=$b --> $a = $a + $b
  • $a-=$b --> $a = $a - $b
  • $a.=$b; --> $a = $a . $b
  • ...
the meaning of the dot is described at http://www.php.net/manual/en/language.o ... string.php
EXDev
Forum Newbie
Posts: 7
Joined: Sun Feb 23, 2003 9:05 am

Post by EXDev »

thanks volka
i know the -= and += but forgot .=
the page u referred me to recalls me that i've read something about .= too.
Thanks alot
Post Reply