Hey guys,
When do we need to use a "." before a variable name? like
.$variable ?
What is the use of it?
"." is used for concatenation ie: $x = $y.$z; $x .= $w;
is this what you mean?
it could also be used in classes
ie: $name. = ""PHP; $name .= " Bulider";
echo $name;
you will get " PHPBulider "
the "." is called concatenation.
all right but sometimes I see it used before the variable
.$variable
Do you have an example of where you have seen it used?
The only use I know for it is, like the other people of said, concatenation.
Originally posted by kelkafa all right but sometimes I see it used before the variable .$variable
Not difficult to work out.
$a='this is '; $b='a string'; echo $a.$b;
Where else have you seen it (except for decimal points, which don't count)?