English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I mean
$disp .=

as opposed to
$disp =

2006-06-17 13:07:33 · 2 answers · asked by holymoly! 2 in Computers & Internet Programming & Design

2 answers

PHP has a operator that allows the user to join two variables together. And that operator is a dot (.)

So if you have this:
==============================
$disp = 'Hi ';
$disp .= 'm0';
print $disp;
?>
==============

The above will print:
Hi m0

When we say equal it is intializing that variable to that. like
====
$a = 1;
$b = 2;
====
So if I print out a it will be 1 or if I prinf out b it will be 2.

If I say:
====
$a = 1;
$c = $a.'3';
print $c;
====
That will print out 13

You could have other forms of operators such as:
===
$a =1;
$a += 2;
===
a will print out 3 since (a += b) is the same as a = a + b;

The correct word for it would be concatentation between variables, the other operators like - or + are only valid for numbers integers.

Good luck on your quest.

2006-06-17 16:29:03 · answer #1 · answered by ? 6 · 2 1

The "." is the string concatenation operator. "$disp.=$more;" is the same as "$disp = $disp.$more;" - whatever is in $more is appended to $disp.

2006-06-17 21:30:36 · answer #2 · answered by injanier 7 · 0 0

fedest.com, questions and answers