By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 993 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

PHP5 code doesnt work

P: 114
Hi guys, i installed WAMP Server 2 yesterday but i waz surprised to see that the following code doesnt work.

[HTML]Today is <? print strftime("%m/%d/%Y"); ?>[/HTML]

The output is just: Today is

If i use the proper php tag i.e <?php ?> it works but what i feel is that php5 files do not have the <?php ?> style. So, whats the problem???
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies

Expert 5K+
P: 6,050
but what you feel is "php5 files do not have the <?php ?> style"?

What? lol.

If it works by using <?php ?> then use them. Simple.
Dec 7 '07 #2

P: 114
Yeah fren, u r right but since all the php5 files that we find today is without the standard php tags. I mean i have downloaded some of the popular files like the Login System with admin features from and i m very eager to make it work in my system. but i have not been able to do it.

i dont know how to do it. I just need s'body who can tell me how i sud go about.
Dec 8 '07 #3

Expert 5K+
P: 6,050
Have a look in your php_ini file.

And switch short_tag_open to 'on'

Dec 8 '07 #4

Expert 5K+
P: 5,058

As Markus says, you can modify the short_tag_open directive to enable or disable the short_tags feature.

In PHP5 this defaults to OFF, while PHP4 defaults to ON, which causes the problem you described.

One of the reason why PHP5 defaults to OFF is that the <? ... ?> tags do not comply with the XHML standard. They are considered invalid syntax in a XHML document.

I recommend designing all code using the <?php ... ?> tags rather than the <? ... ?> tags. That way it will be usable on all servers without any problems.
Dec 9 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.