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
The first two are the same; the third I'm not familiar with.
<?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
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)