Take the 2-minute tour ×

I once posted a question here with php code embedded using <?. Someone told me I should NOT do that and I should use <?php

The person did not tell me why it is so. Can someone please explain why it is unsafe to use <??

share|improve this question

1 Answer 1

up vote 4 down vote accepted

<? (the short tags) can be disabled in the PHP configuration, see short_open_tag.

Why disable it? In some cases you'd want to use <?xml.. definitions for example, sure there are other ways to output that, but it's just safest to use <?php - especially if you plan on moving your code from server to server.

share|improve this answer
Cool! Thanks for the answer! –  arbithero Oct 2 '10 at 22:37

Your Answer


