When to use php end tag and when not to? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When to use php end tag and when not to?

Sololearn teaches to use end tags <?php ?> but in the external courses that am taking, they skip the end tag. 1. Is it applicable to single php statements. e.g. <?php some function()..... and skip end tag 2. Is it valid for multiple php statements. <?php some function ?> <?php another function skip end tag ..

21st Nov 2018, 2:59 PM
Core i9
Core i9 - avatar
2 Answers
+ 2
To my knowledge you only need to end it if your not going to use any other language in the file. So if you want to use just php then you can leave the php tag open but if you use html or something in combination then you need to close the php tag before starting html.
21st Nov 2018, 4:14 PM
Mike
0
thank you.
22nd Nov 2018, 12:37 PM
Core i9
Core i9 - avatar