PDA

View Full Version : <?=


Phantom
04-25-2003, 11:32 AM
I've seen this used to open PHP to use a variable, but what exactly is this for?

<?=$var ?>

seems to be quite equal to

<? $var ?>

Is there any difference? :-)

Eddyd84
04-25-2003, 12:23 PM
<?=$foo; ?>

is equivalent to

<?php
echo $foo;
?>

If short tags are enabled, of course. They usually are.
I hope this helps.
Peace,
Ed
:)

mordred
04-25-2003, 02:56 PM
Be warned that you can't use short tags in an environment that has PHP in XML like pages, like in an XHTML-valid page. The xml declaration must start with

<?xml

and that would throw a parsing error if this page were parsed by PHP with short tags enabled. I wouldn't recommend using them, exactly because they can be turned off by editing the php.ini file, like asp_tags. Better stick with <?php, that works everywhere.