• 0

<?PHP?> vs <?>


Question

9 answers to this question

Recommended Posts

  • 0

ALWAYS use <?php.

It'll help XML parse correct. Some times other scripting languages use the <?something syntax, and then you'll be screwed if they overwrite your code or remove it. Plus, they may remove it in the future, who knows?

Just to guarantee the least headaches, use <?php

Link to comment
Share on other sites

  • 0
What is the difference between using

<?PHP

?>

and

<?

?>

In your PHP code? Does adding the "PHP" do anything?

Eventually <?> etc won't be suported only <?php> infact the next build is rumored NOT to have full support for <?> they will slowly be doing away with it.

Link to comment
Share on other sites

  • 0

They do the same thing, and in the PHP.ini file you can disable the <? version. ASP and other PHP style scripting languages use <? so if you use <?PHP it sets it apart, and it will work on all servers if they have disabled <? ;)

So just use <?PHP is adding 3 letters that hard?

Link to comment
Share on other sites

  • 0

Thanks for the advice guys.

The reason I had asked was because I am new at PHP, only my third week into it and am loving it. I had a look at many example codes, both online and in books but people were being inconsistant. Some were using "<?PHP" and others just "<?" so I was getting kind of confused.

Link to comment
Share on other sites

  • 0

To add to the informative replies, one of the main details about programs, in whichever language,

is that they must be somewhat portable. Some hosts might support the <? ?> tags, but some may

not and that is when it becomes troublesome, when you have to go back and fix everything throughout

your code. This makes programming highly inneficient.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.