Page 1 of 1
<? new opening tag?
Posted: Sat Aug 19, 2006 7:59 pm
by rkalexander
I've seen people using just
instead of
as an opening php tag. Is the new tag valid, and when did it happen?
Probably a noob question, but I want to know. Thanks

Posted: Sat Aug 19, 2006 8:02 pm
by feyd
It's called a short tag, it's been around for quite some time, but is being phased out rather quickly. So don't use it.
Posted: Sat Aug 19, 2006 8:11 pm
by rkalexander
Thank you Feyd.
Posted: Sun Aug 20, 2006 5:05 am
by volka
Posted: Sun Aug 20, 2006 11:06 am
by RobertGonzalez
Short tags are evil and are being depricated in PHP6. If you have them in any of your code, I would seriously recommend updating them to long tags as on some PHP5 systems this is off (in fact, I think PHP5 has them off by default). If short_tags is off and you try to use them you will have some rather interesting results (as I found out recently with a borroed piece of code I was working with).
Posted: Sun Aug 20, 2006 11:56 am
by Ollie Saunders
If you run your own version of PHP for development, turn off short-tags so that you will be forced to comply.
Posted: Mon Aug 21, 2006 5:35 am
by Adesso
I have been using the
for a while now, but still have to figure out how I can improve the short hand
, as
does not work.
Sometimes using the
<?= is usefull for printing out variable values, as I dont like using the long winded echo, but if the short hand is being depricated, what is a developer to do when trying to output variable values in a script?
Any suggestions ?
Posted: Mon Aug 21, 2006 5:40 am
by s.dot
There isn't a shortcut with short tags disabled.
Would just have to become
Posted: Mon Aug 21, 2006 5:58 am
by Chris Corbyn
scottayy wrote:There isn't a shortcut with short tags disabled.
Would just have to become
Which I think is cleaner anyway. At least it's consistent

I don't find the word "print" or "echo" overly offensive or scary... most template languages look scarier than that

Posted: Mon Aug 21, 2006 8:19 am
by RobertGonzalez
When I was a newbie, this
made a lot more sense to me than
So I have been using it all along.