This is an old revision of the document!
PHP RFC: Remove alternative PHP tags
- Date: 2014-09-09
- Author: Nikita Popov firstname.lastname@example.org
- Status: Under Discussion
- Targeting: PHP 7
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 with echo
The listed opening tags will no longer enter PHP mode and the listed closing tags will no longer leave PHP mode.
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 (
- 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 and it's not possible to disable asp tags using
- Supporting different tags allows very weird mixing like
<script language=php> echo "foo" %>
To simplify porting of legacy code using the alternative tags, a porting script 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/
As this is a language change a 2/3 majority is required.