www.webdeveloper.com
Results 1 to 4 of 4

Thread: what is the different in this??

Hybrid View

  1. #1
    Join Date
    Oct 2013
    Posts
    1

    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
    Location
    Voorheesville NY USA
    Posts
    565
    The first two are the same; the third I'm not familiar with.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    <?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).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Sep 2013
    Posts
    221
    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" ?>

    Bgkl8.png

    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



Recent Articles