Computer Science Canada How many people hate <? instead of <?php to start a php document? |
Author: | agnivohneb [ 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. |
Author: | octopi [ 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. |
Author: | Tony [ 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. |
Author: | PaulButler [ 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. |
Author: | md [ 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. |
Author: | Mazer [ 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. |