To be 100% sure that a variable will be correctly printed out on all servers where your code might possibly run, use <?php echo $variableName; ?>
. I personally always use this method.
However, if you're working on a personal project or on a simple project where you know that you will have access to php.ini or where you're not planning to move to another server, then you can safely use it.
Additionaly, <?=
is allowed by default on PHP 5.4 and above, which means all currenttly support versions of PHP support this. From php.net regarding the short_open_tag:
This directive also affected the shorthand <?=
before PHP 5.4.0, which is identical to <? echo
. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?=
is always available.
So, in short, answer to your three questions:
- Is it good practice? No
- Is there any server dependency? Yes (need for enabling it on server)
- All open sources and framework support for this? It is not possible to speak for all. Another good reason to use the full one
But as mentioned above, if you'll be running the code only on servers with supported versions of PHP, then you can safely use it.