# omitting T_CLOSE_TAG

- Thread: https://externals.io/message/18530
- Original archive: https://news-web.php.net/php.internals/18530
- Started by Gabor Hojtsy on 2005-08-29T18:38:48+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #18530 — Gabor Hojtsy — 2005-08-29T18:38:48+00:00

URL: https://externals.io/message/18530#18530

Hi,

I am searching for some evidence in the PHP source code that the
possibility of omitting the closing PHP tag is absolutely intentional,
and in fact part of the language syntax, and therefore it is going to be
supported indefinitely. Digging for `T_CLOSE_TAG` and similar stuff have
lead me to nothing.

Actually I would like to clarify and possibly extend the note on page:
http://php.net/manual/en/basic-syntax.instruction-separation

Also if you have any positive notes on not using the closing tag (or any
negative thereof :), please do let me know.

Thanks,
Goba (PHP Documentation Editor)

---

## #18531 — George Schlossnagle — 2005-08-29T18:49:37+00:00

URL: https://externals.io/message/18530#18531 · In reply to: #18530

> Hi,
>
> I am searching for some evidence in the PHP source code that the
> possibility of omitting the closing PHP tag is absolutely intentional,
> and in fact part of the language syntax, and therefore it is going  
> to be
> supported indefinitely. Digging for `T_CLOSE_TAG` and similar stuff have
> lead me to nothing.
>
> Actually I would like to clarify and possibly extend the note on page:
> http://php.net/manual/en/basic-syntax.instruction-separation
>
> Also if you have any positive notes on not using the closing tag  
> (or any
> negative thereof :), please do let me know.

Benefit: No unintentional leakage of whitespace (following a closing ? 
 >).

George

---

## #18532 — Gabor Hojtsy — 2005-08-29T19:14:04+00:00

URL: https://externals.io/message/18530#18532 · In reply to: #18531

George Schlossnagle wrote:
> > […]
> 
> Benefit: No unintentional leakage of whitespace (following a closing ? >).

Well, the intention of the basic syntax manual page is to point this
exact advantage out, but it is probably badly worded :)

Goba

---

## #18534 — Sara Golemon — 2005-08-29T20:14:46+00:00

URL: https://externals.io/message/18530#18534 · In reply to: #18530

> I am searching for some evidence in the PHP source code that the
> possibility of omitting the closing PHP tag is absolutely intentional,
> and in fact part of the language syntax, and therefore it is going to be
> supported indefinitely. Digging for `T_CLOSE_TAG` and similar stuff have
> lead me to nothing.
>
I can't imagine a situation where that level of BC breakage would *EVER* be
permitted.  In fact, last I heard it was recommended practice for PEAR files
to omit the end tag.

I suppose it might accidently break if include were ever shifted to C style
inclusion, but that breakage would wind up being considered a bug in the
"new feature" and could be easily fixed by automatically reseting the lexer
state before and after the include statement.

> Actually I would like to clarify and possibly extend the note on page:
> http://php.net/manual/en/basic-syntax.instruction-separation
>
An example might be helpful...
"<?php echo 'Foo'; ?>" and "<?php echo 'Foo';" are interpreted identically
by PHP.

-Sara

---

## #18546 — Andi Gutmans — 2005-08-30T04:55:50+00:00

URL: https://externals.io/message/18530#18546 · In reply to: #18534

It is quite intentional and will stick around forever :)

Andi

At 01:14 PM 8/29/2005, Sara Golemon wrote:
> > […]
>I can't imagine a situation where that level of BC breakage would *EVER* be
>permitted.  In fact, last I heard it was recommended practice for PEAR files
>to omit the end tag.
>
>I suppose it might accidently break if include were ever shifted to C style
>inclusion, but that breakage would wind up being considered a bug in the
>"new feature" and could be easily fixed by automatically reseting the lexer
>state before and after the include statement.
>
> > […]
>An example might be helpful...
>"<?php echo 'Foo'; ?>" and "<?php echo 'Foo';" are interpreted identically
>by PHP.
>
>-Sara
