Is using php shorthands bad?

Possible Duplicate:
Are PHP short tags acceptable to use?

I'm just learning php and (been learning for about 6 months) and in a tutorial that I'm going through, it's using php shorthands, so when I looked it up on google, I came to this stack overflow question StackOverflow question where one of the popular answers says that shorthands are bad.

I know one of the following comments then suggest that it's not bad but I also remotely remember reading from a php book before that it's not always good to use them. So I'm a bit confused, are they bad or not?


It is generally a bad idea because of portability. All PHP configurations understand the <?php ?> tags, but not all are configured to use <? ?> <? ?> .

Same thing goes for <? =$variable; ?> <? =$variable; ?> <? =$variable; ?> for printing.


They are not bad actually, but you can say that it's kinda a bit lazy sort of thing to do for a GOOD TECHNICAL programmer. Why I'm using this word " GOOD TECHNICAL " is because, since they know about the technicalities of PHP, then they should also know whether the shorthands will be of any use or not in the long run, whenever any adjustments is to be made regarding the fine tunings of the PHP Server.

But still, it's one of my views & may be it will not match with others' answers.


I personally never use them because I find it makes my code ugly, hard to read and harder to debug. I'm talking about shorthands like the one-line if statement. Not every PHP configuration understands short open and ending tags, and not every programmer knows about shorthand notation so this might be a problem if you want to share code at some point. I wouldn't advise using it.

链接地址: http://www.djcxy.com/p/59436.html

上一篇: PHP开放标签问题

下一篇: 使用PHP shorthands不好?