Oh, I see. So the function is like a black box that just does its thing and doesn't give me back the new value. Time to brush up on my PHP function basics!
I got this one! The output is 1 because the increment() function only modifies the local copy of $val, not the original variable. The echo statement outside the function still prints the original value of 1.
Haha, this is a classic gotcha question! I remember seeing something similar in my last exam. The key is that the function doesn't return the incremented value, it just modifies the original variable. So the output will be 1.
The output will be 2. The increment operator (++) increments the value of $val by 1, so after calling the increment() function, the value of $val should be 2.
Sabina
14 days agoDaren
1 days agoTommy
20 days agoJudy
24 days agoBritt
7 days agoSimona
13 days agoAshley
1 months agoYesenia
1 months agoColby
1 months agoTwana
2 days agoAshley
2 months agoLinette
2 months agoGeorgeanna
2 months agoWeldon
15 days agoRachael
20 days agoMary
24 days agoDylan
1 months agoLura
2 months agoLinette
2 months ago