This topic contains 1 reply, has 2 voices, and was last updated by Vera 1 year, 10 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Girls Who Geek
Home › Forums › Languages › PHP & MySQL › Question about opening php code
This topic contains 1 reply, has 2 voices, and was last updated by Vera 1 year, 10 months ago.
I’ve noticed when I follow scripts and tutorials that sometimes the code will look like…
First use of php code on the page: <?php
and the rest of the page only uses <? when they reopen php
Meanwhile, others I’ve seen use <?php every time they open a php code.
It seems like it works the same either way, so I was wondering: Does it matter? Which is the more correct way? Will there be different results depending on what you use? Thanks!
Both are correct, actually. The second is called a short open tag, and can only work if it is enabled from php.ini (i.e. check that short_open_tag is On, as opposed to Off).
Of course, when you’re being hosted you don’t generally have access to the php.ini file, so there’s nothing you can do to change this setting. As a precaution, it is recommended that you use the long form <?php … ?> which is guaranteed to always work.
We also had a little debate about this topic here: http://girlswhogeek.com/forums/topic/wowzers-learning-curve
You must be logged in to reply to this topic.
Recent Comments