John Smith
John Smith

Reputation: 13

PHP is making me use <?php instead of <?

My Apache/PHP installation is making me use <?php ... ?> instead of <? ... ?>. Where is this found in the configuration file so that I don't need to do the former? I'm assuming it's in php.ini, but not sure what it would be called.

Upvotes: 0

Views: 218

Answers (4)

Stellar Sword
Stellar Sword

Reputation: 6216

Definitely keep using <?php instead of <?, it's good practice and it makes your code more readily mobile for other projects and websites that may have short_open_tag enabled or disabled.

Upvotes: 3

alex
alex

Reputation: 490263

It is defined in php.ini as short_open_tag.

Keep in mind however, for maximum portability, stick with <?php ... ?>. You have just proved to yourself how unreliable it is to rely on short tags being enabled. You wouldn't want to show the world your PHP source if it made its way onto a short tag disabled server would you?

I've also read, but can not confirm, that short tags will be removed in newer versions of PHP.

Upvotes: 4

Messa
Messa

Reputation: 25191

It's the short_open_tag configuration directive. http://php.net/manual/en/ini.core.php

Upvotes: 5

too much php
too much php

Reputation: 91028

The option is called short_open_tag.

Upvotes: 1

Related Questions