Reputation: 29121
In a lot of CakePHP examples, I see <?php echo $myVar; ?>
I've always written this in shorthand like <?php=$myVar?>
Is there any difference? Is <?php echo
better for some reason? I always lean toward the shorter, but - when I see everyone else using the <?php echo
, I wonder - maybe I'm doing it wrong.
What about in CakePHP - is it different for some reason?
Upvotes: 0
Views: 134
Reputation: 83279
<?=
or <?php=
has to be enabled for it to work properly via the short_open_tag in your php.ini. Since some systems out there have this value disabled, it's encouraged that you use <?php echo
to ensure that your code will always work on any system it runs on.
Upvotes: 8