Environment: Windows/7 + Apache/2.2.21 + PHP/5.3.8
File contents of test.php:
hello, <?=$test?>
File contents of index1.php:
<?php
$test = 'world';
require './test.php';
?>
File contents of index2.php:
<?php
global $test;
$test = 'world';
require './test.php';
?>
Output of index1.php is:
hello,
Output of index2.php is:
hello, world
When the contents of test.php is:
hello, <? echo $test; ?>
Output of index1.php and index2.php both are:
hello, world
So, my question is: Is there any difference between <?=$test?> and <? echo $test; ?> ?
No, there is no difference. Only one I think about is that
<?is considered as short tag and might not work.