AndrewRy Posted July 15, 2006 Share Posted July 15, 2006 Hello,I am starting to get more into PHP coding even though I have been using it for several months now. My question is which delimiter is better to use:<?php or <?Is it just general preference or is there one that can be better in some ways than the other depending on PHP version and server? Link to comment https://forums.phpfreaks.com/topic/14699--/ Share on other sites More sharing options...
Chevy Posted July 15, 2006 Share Posted July 15, 2006 I think <? is better, thats what I always use Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58643 Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 it's merely preference. it's better to be in the habit of using <?php, as this will always work. <? will only work when the setting in php.ini (i think it's something like allow_shorttags) is enabled; otherwise, you'd have to go back and change all those tags if you end up on a host that doesn't enable the setting. Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58647 Share on other sites More sharing options...
kenrbnsn Posted July 15, 2006 Share Posted July 15, 2006 It has been rumored that the use of short tags "<?" and "<?=" will be going away in PHP6. The problem is that the start tag for XML also starts with a "<?". So just allowing the short tags can be confusing.Ken Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58670 Share on other sites More sharing options...
hostfreak Posted July 16, 2006 Share Posted July 16, 2006 It depends. As of now, the standard tag <?php ?> and the script tag <script language="php"></script> will always work. The short tag <? ?> will only work if short_open_tag is switched to "on" in php.ini . Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58734 Share on other sites More sharing options...
willfitch Posted July 16, 2006 Share Posted July 16, 2006 Actually,You can run into issues with short tags (<? ). If you are trying to use XML with PHP, XML will require the opener (<?xml), and allowing short tags will confuse the interpreter. Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58794 Share on other sites More sharing options...
wildteen88 Posted July 16, 2006 Share Posted July 16, 2006 I would agree it is down to personal preference. I prefer <?php as then I know my script will run in any enviroment. Also <?, <?= and <script language="php"></script> will be gone as of PHP6. Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.