0

Hi,
I my code i am using open tag like this <?PHP its working fine but if i use <? that time its showing entire code its not showing html pages

Please can anyone tell me how to fix this problem

Regards
Punitha pary

5
Contributors
6
Replies
8
Views
8 Years
Discussion Span
Last Post by cwarn23
0

There are several solutions to this problem. You could modify your php.ini file to allow php short tags. Or if you don't have access to the core php.ini file you can add the following code to the very top of your document.

<?php ini_set('short_open_tag',1); ?><?
0

You can enable short tags, however, there are other servers (like yours) which do no have the short tags option on.

This means that if you deploy the code onto another server, it may not run.
As pritaeas says, it is recommended to the the full <?php opening tag. There is no real reason not to use them.

0

I think the main reason why people prefer short tags is that they are faster to type with 60% less letters/symbols to type. Also they look neater but as previously mentioned, it is best to use <?php for compatibility as I think short tags a depreciated in php6.

0

It's true that short tag has less character to type. But there are many well PHP editor out there, which automatically create a proper <?php ?> syntax with a single click or via hotkey.

0

It's true that short tag has less character to type. But there are many well PHP editor out there, which automatically create a proper <?php ?> syntax with a single click or via hotkey.

But then how many people RTFM to find out what those hotkeys are? Probably find rarely are hotkeys used even if they are available. Also I think some people might like how it is possible to make the opening tag look a lot like the closing tag which is clean and simple. That is what would make people use short tags a lot.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.