Andre :

As Joshua says, the only php tags that always is enabled is <?php ?>, this
is the default php tag, and never can be disabled.

This <? ?> is enabled if short_open_tag is on
And this <% %> is enabled if asp_tags is on

But the default is off for both.

Use this <?php ?>, and forgive configuration options.

Alejandro M.S.

-----Mensagem original-----
De: Joshua Kehn [] 
Enviada em: terça-feira, 10 de maio de 2011 12:19
Para: Andre Polykanine
Assunto: Re: [PHP] Short tag: why is it bad practice?

On May 10, 2011, at 11:11 AM, Andre Polykanine wrote:

> Hi everyone,
> Many  times  I heard that the following two peaces of code are written
> in a bad manner:
> 1.
> <?
> echo "Hello, world!";
> ?>
> 2.
> <form action="script.php" method="post">
> <p>Your   e-mail:   <input   type="text"   id="uemail"   name="uemail"
> value="<?=$f['Email']?>"></p>
> ...
> </form>
> As for now, I use both quite often. Why is this considered not kosher,
> I mean, good coding practice?
> Thanks!
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter:
> Facebook:

Because short tags aren't always enabled and can cause things to break when
deploying code to different environments. Best practice dictates that your
code should be as environmentally independent as possible.

It's another few characters, why neglect it?


Joshua Kehn |

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to