php delimiters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Garry Jones

    php delimiters

    Excuse the newbie question.

    I have seen different types of delimiters to note php code.

    <?php and ?>
    and
    <? and ?>

    However the code
    <?= and ?>
    is marked up by Dreamweaver as php delimiters. (ie not part of the code
    itself). I have noticed that the = is necessary sometimes but would like an
    explanation about its use.

    Whats the difference between these codes? Are there any limitations on
    browser versions, platforms, or other user settings that favour either pair
    of delimiters.

    Garry Jones
    Sweden



  • David Haynes

    #2
    Re: php delimiters

    Garry Jones wrote:[color=blue]
    > Excuse the newbie question.
    >
    > I have seen different types of delimiters to note php code.
    >
    > <?php and ?>
    > and
    > <? and ?>
    >
    > However the code
    > <?= and ?>
    > is marked up by Dreamweaver as php delimiters. (ie not part of the code
    > itself). I have noticed that the = is necessary sometimes but would like an
    > explanation about its use.
    >
    > Whats the difference between these codes? Are there any limitations on
    > browser versions, platforms, or other user settings that favour either pair
    > of delimiters.
    >
    > Garry Jones
    > Sweden
    >
    >
    >[/color]

    This was discussed quite recently so rewind your news for the details,
    but in summary:

    <?php and <? are equivalend if and only if short_open_tag is set to 'on'
    in the php.ini file.

    Similarly, <?php echo and <?= are equivalent with the same restriction.

    Use of the short tags can cause problems with XML parsers, application
    portability and the future direction of PHP, so get used to using the
    long forms. i.e. use <?php and <?php echo.

    -david-

    Comment

    Working...