# RFC: Remove alternative PHP tags

- Status: Implemented (PHP 7.0)
- Authors: Nikita Popov nikic@php.net
- Date: 2014-09-09
- Original: https://wiki.php.net/rfc/remove_alternative_php_tags
- Page: https://externals.io/rfc/remove_alternative_php_tags
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Votes

### Remove alternative PHP tags in PHP 7? (closed)

Yes: 26 · No: 8

Voters: ajf (No), auroraeosrose (Yes), brianlmoon (Yes), bwoebi (Yes), crodas (Yes), datibbaw (Yes), daverandom (Yes), derick (No), dsp (No), fa (No), frozenfire (Yes), guilhermeblanco (Yes), gwynne (Yes), jedibc (Yes), jwage (Yes), kalle (Yes), kassner (Yes), krakjoe (Yes), kriscraig (Yes), leigh (Yes), levim (Yes), lstrojny (Yes), mariuz (Yes), nikic (Yes), olemarkus (Yes), patrickallaert (Yes), peehaa (Yes), pollita (No), rasmus (No), rdlowrey (Yes), rogeriopradoj (Yes), salathe (No), stas (No), tyrael (Yes)

## Discussions on the mailing list

- [Remove alternative PHP tags](https://externals.io/message/77122.md) — started on 2014-09-09, 12 messages
- [\[VOTE\] Remove alternative PHP tags](https://externals.io/message/77585.md) — started on 2014-09-24, 3 messages
- [Alternative PHP tags and strict_types=1](https://externals.io/message/86220.md) — started on 2015-05-14, 2 messages

---

## Proposal

This RFC proposes the removal of ASP tags (`<%`) and script tags (`<script language=php>`) as a means of entering or leaving PHP mode.

The following syntactical elements are removed:

- `<%` opening tag
- `<%=` opening tag with echo
- `%>` closing tag
- `(<script\s+language\s*=\s*(php|"php"|'php')\s*>)i` opening tag
- `(</script>)i` closing tag

The listed opening tags will no longer enter PHP mode and the listed closing tags will no longer leave PHP mode.

Additionally the `asp_tags` ini directive is removed. Trying to enable `asp_tags` will result in a core error.

This RFC does ***not*** remove short opening tags (`<?`) or short opening tags with echo (`<?=`).

## Reasoning

- The alternative PHP tags have never gained any significant degree of usage. Their usage has been discouraged since forever.
- The ASP tags depend on an ini directive and as such are non-portable. We generally try to move away from ini-dependent language behavior. With ASP tags removed, short open tags should be the last.
- ASP tags [clash with underscore.js templates](http://stackoverflow.com/questions/14694116/how-to-disable-asp-style-php-tags-within-a-specific-file) and it's not possible to disable asp tags using `ini_set()`.
- Supporting different tags allows very weird mixing like `<script language=php> echo "foo" %>`

## Porting tool

To simplify porting of legacy code using the alternative tags, a [porting script](https://gist.github.com/nikic/74769d74dad8b9ef221b) is provided. The script takes a directory and will replace ASP and script tags in all `.php` files contained in this directory:

```
php -d asp_tags=1 portAlternativeTags.php dir/
```

## Vote

The vote started on 2014-09-24 and ended on 2014-10-01. The required 2/3 majority has been reached, as such this RFC is accepted.

**Vote: Remove alternative PHP tags in PHP 7?** — Yes: 26 · No: 8 (closed)
