Difference between <?php ?> and <? ?>

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ammu
    New Member
    • Aug 2011
    • 78

    Difference between <?php ?> and <? ?>

    anybody can pls tell me what is the difference between using <?php ...?> and <?...?> tags in php
    Last edited by Meetee; Dec 7 '11, 06:22 AM. Reason: code tags removed: use code tags only when code is inserted in post
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    <?...?> is called short tag. If you use short tag you would be able to write php code in short tag. it also can used in HTML TAG. as example
    Code:
    <INPUT TYPE='text' value=<?=$value?>>
    But If you want to use a combination of other non php tag it would conflict such as
    <?xml ?>

    but you can achieve it anyway

    Comment

    • AutumnsDecay
      New Member
      • Mar 2008
      • 170

      #3
      To expand on Johny's comment, some servers (Mainly apache) will initiate a PHP code block when <? ?> is used, however, Windows-based servers require <?php ?> tags.

      Comment

      Working...