Results 1 to 4 of 4

Thread: what is the different in this??

  1. #1
    Join Date
    Oct 2013

    what is the different in this??

    please tell me..

    what is the different b/w in these element of php?

    <?PHP ?>,<? ?> and <?= ?>

    Thank you in advace

  2. #2
    Join Date
    Jul 2013
    Voorheesville NY USA
    The first two are the same; the third I'm not familiar with.

  3. #3
    Join Date
    Aug 2004
    <?php always works.

    <? is the same, but only works if the short_open_tags setting is enabled. Therefore I recommend to always use the first.

    <?= is shorthand for <?php echo, but only works if short_open_tags is enabled, or if you are using PHP 5.4.0 or later (in which case it's always enabled, even if the short_open_tag is not).
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Sep 2013
    The first is a safe open and close tag variation, the second is the so called short-open tag. The second one is not always available, use the first option if it's possible. You could check the availability of short open tags in php.ini, at the short_open_tag.

    The primary issue with PHP's short tags is that PHP managed to choose a tag (<?) that was used by another syntax, XML.

    With the option enabled, you weren't able to raw output the xml declaration without getting syntax errors:
    <?xml version="1.0" encoding="UTF-8" ?>


    Hope this helps.
    strad solutionswww.stradsolutions.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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