Full Stack Web Developer

PHP short_open_tag: On or Off?

I say ON!

There is always debate over whether it’s best to always use <?php to open any PHP script because by default, web servers are set up to not allow for short code. However, I feel it’s better to allow for both <? and <?php to prevent senseless hours of “Why isn’t my code working?” when all it could be is one little <? instead of <?php tag being used.

Coding consistently should always be something we strive for as developers (no matter the language), but be honest, formatting is in the eye of the beholder. Coding your own creation from scratch can become a work of art, but when in a team working on a system, consistency and predictability are key.

There are best practices out there to follow, and if you prefer <? over <?php, just make sure to remain consistent.