How to enable PHP short tags?

PHP short tags are a shortened version of the standard PHP opening tag <?php. Instead of using <?php, you can use the shorter <? or <?= to open a PHP block.

To enable short tags, you need to set the short_open_tag configuration setting to On in your php.ini file. The php.ini file is the main configuration file for PHP, and it controls a wide range of PHP settings.

Watch a course Learn object oriented PHP

To enable short tags, find the short_open_tag setting in your php.ini file and set it to On like this:

short_open_tag = On

Once you have made this change, save the php.ini file and restart your web server to apply the changes.

Keep in mind that short tags are not always available on all systems and may not be compatible with all versions of PHP. It is generally recommended to use the full <?php opening tag instead of short tags.