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 ?>


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.




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to