daydreamer Posted February 18, 2008 Share Posted February 18, 2008 I am trying to get my PHP code like this: <?="Hello"; ?> Instead of this: <?php echo "Hello"; ?> Ive changed line 131 in my php.ini config file, to short_open_tag = On I have done this, reloaded my php/apache server, but it still wont use the code. no error, but no output. I am using wamp server on my desktop to test it. Is this the right file I should be editing: C:\wamp\bin\php\php5.2.5\php.ini ? Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/ Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 You really should get used to using the long tags instead of the short tags. To discover the correct php.ini file to change, check the output from phpinfo() Ken Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/#findComment-469867 Share on other sites More sharing options...
daydreamer Posted February 18, 2008 Author Share Posted February 18, 2008 Thanks. this is the one i was supposed to be using: C:\wamp\bin\apache\apache2.2.6\bin\php.ini I am following a tutorial in a book, and hes using short tags. Eventually I will want to upload my php to a propper hosting server. Can you use short tags on them, or change the php.ini settings on your hosting account? Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/#findComment-469871 Share on other sites More sharing options...
PHP Monkeh Posted February 18, 2008 Share Posted February 18, 2008 Chances are your web host won't allow you to switch them on/off, even if you e-mail them asking nicely. Just get used to using the normal tags, you'll appreciate it in the end. Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/#findComment-469872 Share on other sites More sharing options...
PFMaBiSmAd Posted February 18, 2008 Share Posted February 18, 2008 Short open tags result in code that is not portable between servers and you won't always have the ability to turn the setting on. If you want to write code that will always work and you won't need to go back and change it, always use <?php and <?php echo instead of <? and <?= [Note: to php.net. Short open tags were a bad idea (look how much wasted time and non working code they have caused) and should be removed in php6, along with all the other multi-way settings that have nothing to do with configuring php on any specific server.] Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/#findComment-469878 Share on other sites More sharing options...
daydreamer Posted February 18, 2008 Author Share Posted February 18, 2008 ok thanks for the info. In that case im going with the <?php echo way. Link to comment https://forums.phpfreaks.com/topic/91733-short_open_tag-on-why-wont-it-work/#findComment-469909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.