-2

When I started learning about php I learned that when I want to call php I needed to put the php code between the this code <?php ?> but I also seen that <? ?> so I've stucked to working with the second option.

Is there any difference between the two of them because recently I've seen that on one machine the second option didn't worked while the first did so it confused me very well.

Cœur
  • 37,241
  • 25
  • 195
  • 267
adi
  • 417
  • 4
  • 25
  • 1
    Duplicate: [Are PHP short tags acceptable to use?](http://stackoverflow.com/q/200640/938236) – Francisco Presencia Apr 17 '13 at 16:16
  • 1
    @FrankPresenciaFandos I know it's a dup. http://meta.stackexchange.com/q/156102; http://meta.stackexchange.com/q/142238; http://meta.stackexchange.com/q/135364 – Matt Ball Apr 17 '13 at 16:19
  • Note: the duplicate is a bit outdated, it doesn't note that [Since PHP 5.4.0, = is always available.](http://www.php.net/manual/en/ini.core.php#ini.short-open-tag) – Francisco Presencia Apr 17 '13 at 16:21
  • Sorry did not know they are referenced as short tags so did not know how to search for it on google.Thank you for your prompt helpfull answers. – adi Apr 17 '13 at 16:25

2 Answers2

0

<? is called short tag that it is discouraged because it needs a specific php.ini setting to be enabled. I've ran into a few shared servers where <? is disabled. Therefore you should try to use <?php instead.

You can also check the documentation.

Ares
  • 5,905
  • 3
  • 35
  • 51
0

There is no difference other than a configuration setting that is needed for

See details here: http://www.php.net/manual/en/language.basic-syntax.phptags.php

Laurence Moroney
  • 1,263
  • 8
  • 20