Log in

View Full Version : <? instead of <?php



gurmeet
02-01-2010, 09:36 AM
my WAMP does not support <? tag
i have to write <?php instead of <?
so i am unable to reun the scripts which contains <? tag
i herad about it to make changes in php.ini to support <? tag..
if any1 know plz help
thnaks in advance

djr33
02-01-2010, 09:42 AM
There are three possible tags for PHP code:
<?php .... ?>
<? ..... ?>
<% .... %>

The last one is especially bad: it is confusing compared to ASP (and others?).

While <?....?> can work, I don't recommend it: it's less clear and not supported by all hosts. It's a much better idea to fix the code than to patch the server.

There's also the option of a special syntax for echoing variables:
<?=$variable?> which is like <?php echo $variable; ?>
This is, again, a bad idea for the same reasons as above.


If you want to change the server, though, look here:
http://php.net/manual/en/ini.core.php

The term you want to search for on google (if you need more info) is "php short tags".

traq
02-01-2010, 02:19 PM
To further what daniel says, I would recommend changing the tags, not your php.ini. You can do a search-and-replace with any good text editor.

gurmeet
02-01-2010, 04:32 PM
To further what daniel says, I would recommend changing the tags, not your php.ini. You can do a search-and-replace with any good text editor.

i agree
but i want ot learn the way of php.ini

fileserverdirect
02-04-2010, 02:29 AM
It's called short_tags I believe. A simple "false" to "true" or "0" to "1" should fix this problem in php.ini

djr33
02-04-2010, 04:14 AM
That is correct, but the other forms may be enabled by different settings. The link in my post above explains it all.