Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How many people hate <? instead of <?php to start a php document?
Index -> CompSci.ca, General Discussion -> Featured Poll
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Do you hate <? instead of <?php to start a php document?
(No ending time set)
Only <?php
42%
 42%  [ 3 ]
Prefer <?php
42%
 42%  [ 3 ]
Dosen't matter
0%
 0%  [ 0 ]
Prefer <?
14%
 14%  [ 1 ]
Only <?
0%
 0%  [ 0 ]
Total Votes : 7

Author Message
agnivohneb




PostPosted: Mon Jan 07, 2008 8:57 pm   Post subject: How many people hate <? instead of <?php to start a php document?

I think this is just laziness not to include three little letters after a 'q' mark. Its not only this but I don't want my server to read <? alone. Don't ask why it is just personal preference. And if I like the program I have to change everything to <?php.

EDIT: I also had a option for 'Only <?' but it did not add. Any mod fix this please.
Sponsor
Sponsor
Sponsor
sponsor
octopi




PostPosted: Mon Jan 07, 2008 9:31 pm   Post subject: Re: How many people hate <? instead of <?php to start a php document?

I also prefer to see <?php

Just a matter of preference....I wouldn't go as far as changing existing code though.
Tony




PostPosted: Mon Jan 07, 2008 9:53 pm   Post subject: RE:How many people hate <? instead of <?php to start a php document?

I haven't done PHP in a while...

with Rails, I use a - dash (or an = equals sign) to start the line of code off. It's not lazy, and it comes out to be very clean.

Then again PHP is a completely different beast.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
PaulButler




PostPosted: Mon Jan 07, 2008 10:36 pm   Post subject: RE:How many people hate <? instead of <?php to start a php document?

I don't do much PHP these days, but I don't like <? to the point that I disable them. You can do this by setting short_open_tag = Off in php.ini.

The reason I dislike it is not personal preference, but that they interfere with the XML version tag that is needed (or at least recommended) for valid XHTML.

If it weren't for the XML problem, I wouldn't consider it laziness to have just <?. Especially in the form of <?= $x; ?>, which is much shorter than the equivalent, <?php echo $x; ?>. Laziness is a good thing if it means writing less unnecessary code.
md




PostPosted: Mon Jan 07, 2008 11:06 pm   Post subject: RE:How many people hate <? instead of <?php to start a php document?

the problem with <? instead of <?php is that the php interpreter gets confused if you mix xhtml and php and have the require <?xml ... /> line.
Mazer




PostPosted: Tue Jan 08, 2008 10:50 am   Post subject: RE:How many people hate <? instead of <?php to start a php document?

I stick with <?php for the reasons mentioned above. You don't always know when <? will be disabled (I suppose you could change it in a .htaccess or something, but whatever) so I just make it a habit to use the long version.
Display posts from previous:   
   Index -> CompSci.ca, General Discussion -> Featured Poll
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: