temp question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

temp question

what does temp = "7" temp += "2" puts temp in php mean?

22nd Dec 2023, 9:57 PM
Jennifer
2 Answers
+ 1
temp is a variable which holds value 7 temp += "2" means temp = temp + "2" = "7" + "2" = 72
23rd Dec 2023, 2:24 AM
A͢J
A͢J - avatar
0
Jennifer, In PHP your data automatically transfers! $temp = "7"; $temp += "2"; echo $temp; This results your temp variable to become 9! So it outputs 9. But in other languages, like JavaScript, Java, C#, and... your data won't change and it stays as string, so they result in 72.
23rd Dec 2023, 1:35 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar