arbithero
arbithero

Reputation: 436

Why should we use <?php for embedding php code?

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 <??

Upvotes: 0

Views: 76

Answers (1)

CharlesLeaf
CharlesLeaf

Reputation: 3201

<? (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.

Upvotes: 4

Related Questions