Very often, when I am passed on a php-based project from another developers, I come across <? as an alternative short version of the php opening tag and it never works on my local server. I wonder why these programming background php developers tend to do this instead of typing a full tag. I am a designer background php developer. Also, I come across this very often which puzzles me, <?= bloginfo('template_directory'); ?> Is anyone can advise me how to make this short hand tag <? and <?= to work on my local server? Or please advice what I can do about them? should I change these two type of short hand to <?php ;?> ? Many thanks, Lau
short_open_tag = Off Code (markup): Search that on your php.ini file and change it to On to activate short tags Or you can fix it, replace 1) "<?=" with "<?php echo " 2) "<?" with "<?php" 3) and finally "<?phpphp" with "<?php" but if you have a lot of files will take you some time
I hadn't heard this. Do you have any citation? I can't find it mentioned on the php.net site. If it's true then I need to make some policy changes.
Shoot. I was off. I was thinking of Register Globals, which have been taken out in PHP 6. It's just not proper coding to use shorthand, unless the server supports it. I hope I didn't confuse anyone.
There is no problem with using it. Just make sure that your server's php installation supports it and that it is enabled. If you ever need to switch to a server that doesn't support it, it will take you a few minutes to replace all the short tags.