Page 1 of 1
How do you enclose PHP tags..
Posted: Thu Oct 30, 2003 4:57 am
by igoy
I was just wondering this morning while I was coding...
How do other people write PHP tags...
that is, do they use
<?php ?> or just
<? ?>, and why ?
I mean I started my PHP coding with
<? ?> coz' it was simple and easy to write, but now I use
<?php ?> 
, why ?
just because I love PHP.
so please let me know what do you use and why..
Posted: Thu Oct 30, 2003 5:29 am
by volka
since <?php always work and <? not I use <?php
Posted: Thu Oct 30, 2003 5:31 am
by Nay
Also <?php although until recently, I was using <?. I got errors popping up all over the place since I needed to use <?xml version=1?>, for my XHTML documents. Then I turned the short tags off and just use <?php for everything.
Since then, my hands have just been used to typing <?php

...
-Nay
Posted: Thu Oct 30, 2003 5:56 am
by McGruff
Imho short tags are an irritating source of potential errors. Sooner or later a script written with short tags will get installed somewhere they're not enabled resulting in fire, flood and earthquakes.
An accident just waiting to happen.
Posted: Thu Oct 30, 2003 6:06 am
by twigletmac
Using XML so <? ?> is a definite no no for me. Plus, as others have mentioned, it can be disabled so it's not reliable. <?php ?> is a much better option IMHO.
Mac
Posted: Thu Oct 30, 2003 4:06 pm
by Cruzado_Mainfrm
i got stuck with the <?php because i read in my book that there are compatibility problems when designing pages with XML content or XHTML...
Posted: Thu Oct 30, 2003 4:37 pm
by Heavy
<?php of course... Since it is sufficiently unique.
I think you should have added <script language="php"></script> to the poll options since I havn't seen anyone using it...
Posted: Thu Oct 30, 2003 9:11 pm
by m3mn0n
<? ?>
Why? Less typing.
If someone does install it on a system without short tags enabled, it's a simple matter of leaving a note in a README file or enabling it yourself. I'd never stop using this way because of incompatability issues. That's like never coding
gd or
ming because it might not be enabled on the server someone else might have configured differently.

Posted: Thu Oct 30, 2003 9:14 pm
by Gen-ik
I use <? ?> but after reading these posts I'm going to change to <?php ?> to save future headaches

Posted: Thu Oct 30, 2003 9:15 pm
by volka
but it makes it more difficult to hande xml (as mentioned by twigletmac)
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
Posted: Thu Oct 30, 2003 9:21 pm
by scorphus
I vote for <?, have been using it for a long time, now I tend to use <?php due to compability and portability issues...
But when it comes to use <?= what do you switch to? <?php echo?
Cheers,
Scorphus.
Posted: Thu Oct 30, 2003 9:25 pm
by Cruzado_Mainfrm
if u have short tags enabled u will have to use:
Code: Select all
<?php echo "<?xml version="1.0" encoding="ISO-8859-1"?>"; ?>
to use xml
Posted: Fri Oct 31, 2003 2:22 am
by twigletmac
It's probably something to note, that if you're using <? ?>, you are at the mercy of server configurations as well as having to face the possibility that the PHP dev team may remove the option for short tags altogether because of compatibility issues with XML. Not saying they will but they did turn off register_globals, so I doubt short tags are sacred to them.
Mac
Hmmm.. Interesting
Posted: Fri Oct 31, 2003 4:14 am
by igoy

Cool... I started using <?php ?> because I loved working on PHP so much that I wanted my tags to scream "Yeah, I'm PHP tag"... LMAO..
never thought about compatibility.. o_0 ..
Well, good thing in disguise... hehehe

Posted: Mon Nov 03, 2003 1:32 pm
by marzipan
You should use <? php at least at the start of the page, and definitely everytime you have a code snippet if you're mixing in other technologies on the page.
Don't forget to //document your functions. It's the best gift you can give to yourself as a newbie. If you're consulting, clients will really appreciate the professionalism of easy to read, easy to understand code.
For instance, //this code rocks, or //I rule, look here
