please tell the use of dot . after the $name and in previous cases we had use double dots ...plz reply fast? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

please tell the use of dot . after the $name and in previous cases we had use double dots ...plz reply fast?

17th Feb 2017, 3:13 PM
Aman Gupta
Aman Gupta - avatar
7 Answers
+ 16
It's used to concatenate stuff..... $name = "noob"; echo "hello ".$name;
17th Feb 2017, 3:20 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
It used to combine strings(commonly)
6th Mar 2017, 3:19 PM
Animesh
Animesh - avatar
+ 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\'';
17th Feb 2017, 3:47 PM
Larry Allen
Larry Allen - avatar
0
thanks bro got it
17th Feb 2017, 3:21 PM
Aman Gupta
Aman Gupta - avatar
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
17th Feb 2017, 3:25 PM
Larry Allen
Larry Allen - avatar
0
plz also tell difference btwn 'x' and "x" while assigning the value
17th Feb 2017, 3:31 PM
Aman Gupta
Aman Gupta - avatar
0
. is used to concatenate string
29th Mar 2017, 10:04 AM
Dushyant