Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP short open tag vs long open tag [duplicate]

Possible Duplicate:
Are PHP short tags acceptable to use?

Which is better to use, or considered better practice: <?php or <?. I've always wanted to know. Or is it more of a preference for the programmer.

like image 987
brenjt Avatar asked Nov 04 '11 03:11

brenjt


2 Answers

<?php is the official standard. I've never encountered a problem where a browser was confused, but just using <? can also declare XML and might not be the best habit to form.

I'll tell you this though - other programmers will always appreciate the standard. I would go with <?php for sure.

like image 125
Kai Qing Avatar answered Sep 26 '22 02:09

Kai Qing


<?php - always, definitely.

Several reasons; the biggest being "disambiguates PHP from SGML (e.g. XML)".

like image 38
paulsm4 Avatar answered Sep 22 '22 02:09

paulsm4