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? Quote 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 Quote 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. Quote 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 Quote 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 . Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/14699--/#findComment-58912 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.