Advertisement:

Author Topic: The short tag '<?' or the long tag '<?php' ?  (Read 137029 times)

Offline NathanKP

  • Semi-Newbie
  • *
  • Posts: 30
The short tag '<?' or the long tag '<?php' ?
« on: October 18, 2007, 11:40:29 AM »
Is it better to use the short PHP tag "<?" or the long PHP tag "<?php"?  I've seen both used quite extensively, but I noticed that web hosts have to enable the short tag in php.ini.  Is the short tag usually supported by web hosts, or should I use the long tag to be on the safe side?

NathanKP
« Last Edit: October 19, 2007, 12:23:17 AM by Bigguy »

Offline codenaught

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 14,655
  • Gender: Male
  • Formerly Known As akabugeyes
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #1 on: October 18, 2007, 11:41:52 AM »
I would definitely recommend using <?php. I've never had problems with it, but I will tell you I have had problems using the <? tag before.
Dev Consultant
Former SMF Doc Coordinator

Offline NathanKP

  • Semi-Newbie
  • *
  • Posts: 30
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #2 on: October 18, 2007, 12:36:51 PM »
Okay, thanks!

NathanKP

Offline mindphp

  • Semi-Newbie
  • *
  • Posts: 40
    • PHP In Thailand
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #3 on: November 08, 2007, 02:18:09 PM »
I would definitely recommend using <?php. I've never had problems with it, but I will tell you I have had problems using the <? tag before.
if you use <?
php.ini --->short_opentag=On

Offline vBulletin

  • Newbie
  • *
  • Posts: 1
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #4 on: October 29, 2008, 07:37:42 AM »
if you use <?
php.ini --->short_opentag=On

Thank you, mindphp. :)

A12

  • Guest
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #5 on: November 24, 2008, 01:24:33 AM »
I only ever use <?php for compatibility reasons, as not every server has short tags enabled(a.k.a what mindphp said lol...).

Offline mindphp

  • Semi-Newbie
  • *
  • Posts: 40
    • PHP In Thailand
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #6 on: November 25, 2008, 02:17:37 PM »
I mean config of php

Offline MF30

  • Jr. Member
  • **
  • Posts: 119
    • Futebol Tuga
Re: The short tag '<?' or the long tag '<?php' ?
« Reply #7 on: August 25, 2009, 05:06:20 PM »
I would definitely recommend using <?php. I've never had problems with it, but I will tell you I have had problems using the <? tag before.

Ty. :P