Jump to content

short_open_tag = On, Why wont it work?!


daydreamer

Recommended Posts

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

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?

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.]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.