Skip to content
doubtly

1 answer

The syntax for PHP code traditionally uses <?php ?> for opening and closing tags. However, PHP also supports a short form <? ?> for opening and closing tags, and this is often referred to as the "short open tag" syntax.

The use of short open tags (<? ?>) can depend on the server configuration. Some servers may have this feature enabled, while others may have it disabled due to security considerations.

Despite its availability, the use of <?php ?> is generally recommended for better compatibility across different server environments. This helps ensure that your PHP code works consistently, regardless of the server's specific settings.

In summary, while <? ?> is a valid syntax, <?php ?> is the more widely accepted and portable form, making it a safer choice in most scenarios.

Doubtly · 10 Nov 2023 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.