To end the php code we can use <? , In fact it is just optional and we should leave it when we are following OOP. This helps us to remove unwanted whitespaces.
This is the core rule of Codeigniter also.
But sometimes leaving this make code unclear and messy.
Conclusion , so use this ?> when it’s required and you want to make code more clean. Else leave easily.