Why i should use dot in the above line before and after $num | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why i should use dot in the above line before and after $num

echo "Counter is ".$num."<br />";

10th Nov 2016, 5:01 PM
Vishal Dubey
Vishal Dubey - avatar
2 Answers
+ 1
to separate variable from string. Your string is constant, but variables can be dynamic. For more information comment
10th Nov 2016, 5:13 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
with the dot you concat strings so in this line you put the two strings and the var $num into one big string and then bring it to the output. you could also use: echo "Counter is $num <br/>"; this would inject the value of $num in the String. but you have to use the doubled " ! this does not work with single '
10th Nov 2016, 5:15 PM
jmey