Why are we putting dots there ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why are we putting dots there ?

echo "name is " .$name. //Why are there dots before and after $name?

17th Sep 2021, 6:46 AM
Serious Sam
Serious Sam - avatar
1 ответ
+ 1
php uses dots to concatenate strings so: echo "name is " . $name; => echo "name is $name"; and the dot after $name is meaningless and will raise an error (it should be ; not .) Note: dots should only be used before variables\strings not after them
17th Sep 2021, 7:00 AM
Nima