+ 1
please tell the use of dot . after the $name and in previous cases we had use double dots ...plz reply fast?
7 odpowiedzi
+ 16
It's used to concatenate stuff.....
$name = "noob";
echo "hello ".$name;
+ 3
It used to combine strings(commonly)
+ 1
For a simple 'x' and "x" there is no real difference. The difference is with more complex strings. For instance double quotes can have curly braces for adding variables inside your string. "Welcome {$name} to our site" where as single quotes would need to be concatenated by the dot. 'Welcome ' . $name . ' to our site' There also other uses with strings that have quotes in them. Here are a couple examples:
$string ='He said "Welcome"';
$string = 'He said \'Welcome\'';
0
thanks bro got it
0
A dot . is used to concatenate. If you have a variable $name = "John" and wanted to add a string to the variable you would use a dot.
Your code would be:
echo "Name: " . $name;
which would display:
Name: John
0
plz also tell difference btwn 'x' and "x" while assigning the value
0
. is used to concatenate string