Issue with <? and <?php

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Issue with <? and <?php

Postby sanjaydsh » 15. February 2011 20:55

I've a wierd problem. When I create a php file with the following:

<?
echo "Hello World";
?>

it does not work.

When I change it like below, it works.
<?php
echo "Hello World";
?>


IS there a way to make both work in xampp php? Please help/advise. Thank you!
sanjaydsh
 
Posts: 6
Joined: 15. February 2011 20:49

Re: Issue with <? and <?php

Postby Sharley » 15. February 2011 21:09

What version of XAMPP?

sanjaydsh wrote:<?
echo "Hello World";
?>
This should not be used now and see the \xampp\php\php.ini file under short_open_tag section for the reason.
sanjaydsh wrote:<?php
echo "Hello World";
?>
This is the correct method to use.

Short_open_tag set to On or Off or either depends now on the version of XAMPP you are using.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Issue with <? and <?php

Postby sanjaydsh » 15. February 2011 23:06

Awesome!!! Thank you, this change worked.

I agree, we are using "<?php" only, but there is a legacy application we inherited and it was not working. Now it worked. We'll try to update this on all the pages in future releases.

Thank you very much!
sanjaydsh
 
Posts: 6
Joined: 15. February 2011 20:49


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests