Re: is <?= good?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 1:34 AM +0300 6/11/10, Ahmed Mohsen wrote:
I know that i should use the full open tag in php <?php ?> but i want to know if its good to use this tag <?=$name?> instead of <?php echo $name ?>

Ahmed:

In many cases it boils down to an individual preference. I am sure you will find programmers on both sides and in the middle of this argument. Some saying they never use it, others saying that they always use it, and still others saying "It depends" -- meaning they use it in certain cases.

I believe, just because it can be done doesn't mean that it should be done.

My practice is *never* to use <?=

In fact, my practice is to not only use <?php echo, but to enclose the echo argument with a (), like:

<?php echo("The answer is $answer");?>

I am sure there will be some that think that my practice is an overkill, or not "good practice", but it's a good thing that we all have a choice. Make your choice to best serve how you want your code to look.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux