SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: <?php VS <?

  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <?php VS <?

    Hi there,

    what is the difference between <?php ... and <? ... ? Are there any disandvantages when I use <? ... ?

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Short tags might be turned off.
    -- Jelena --

  3. #3
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When using XML <? can be ambiguous because the XML tags start with <?xml
    Always write your PHP with <?php for maximum compatability

  4. #4
    SitePoint Addict GeertDD's Avatar
    Join Date
    Feb 2005
    Location
    Belgium
    Posts
    334
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I always keep short tags on and use them.

    I like to keep my file sizes to the minimum, and (nearly) all of the php tutorials out there use shorties.

    If you don't do XML, you should use short tags. you never know, it might make your "p" and "h" keys last longer... :0
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall
    I always keep short tags on and use them.

    I like to keep my file sizes to the minimum, and (nearly) all of the php tutorials out there use shorties.

    If you don't do XML, you should use short tags. you never know, it might make your "p" and "h" keys last longer... :0
    most tutorials are written by amateurs.

    wait until one day when your webhost turns off short tags, maybe even just temporarily/accidently due to a php upgrade or whatever. all of your php source code is going to be spilled to the browser as plain text for all your users to see, and probably even your database connection details too if its not in some file outside of the webroot. oh yeah, and your website wont work either.

    dont use short tags unless you are 100% sure the setting will never be turned off.

    id wager to say that most people who use short tags, dont realize this is an optional setting, and thus dont realize what will happen when setting is turned off. the potential consequences are too big for the slight benefit of not having to type a few extra characters per tag.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •