Variable Declaration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shobu
    New Member
    • Mar 2007
    • 3

    #1

    Variable Declaration

    $variablename.= 10
    Please explain the use '.="
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    It is same as
    [PHP]$variablename = "some value";
    $variablename = $variablename . 10;[/PHP]

    Comment

    • devsusen
      New Member
      • Feb 2007
      • 136

      #3
      Hi,

      in php dot(.) is basically the string concatenation operator. so writing
      [PHP]$var .= 10; [/PHP]
      means,
      [PHP]$var = $var . 10[/PHP];

      here in this example 10 will be concatenated with the value of $var as string. There will be no mathematical addition if $var also contain number too.

      susen

      Comment

      Working...