0

I removed the t semicolon from the the last line it is also working correctly why?

<?php echo "1"; echo "2"; echo "3" ?> like these

20th Dec 2019, 2:59 PM
khan Aamir
2 Respostas
+ 1
The funny part is, it doesn't work if it wasn't the very last line. If the semicolon for printing "2" was removed for example. Perhaps PHP sees that it was the last instruction, or probably automatically inserts a semicolon there and be forgiving. Interesting! I vaguely remember someone asked this before, but maybe the question was poorly tagged, it can't be found now :(
20th Dec 2019, 3:44 PM
Ipang
+ 1
If a closing php tag is encountered, it implies a semicolon. For good practice and readability, it's best to use semicolons to reduce the likelihood of errors. https://www.dummies.com/programming/php/php-syntax/
21st Dec 2019, 2:36 AM
Xyenia 🦉
Xyenia 🦉 - avatar