PHP Remove alternative PHP tags (PHP7)

Discussion in 'Programming Languages' started by Adam, Oct 2, 2014.

  1. Adam

    Adam Habitué

    1,863
    297
    +603
    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 change 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 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" %>
    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:
    php -d asp_tags=1 portAlternativeTags.php dir/

    The vote passed with a vote total of 26 vs 8

    source: https://wiki.php.net/rfc/remove_alternative_php_tags#vote
     
  2. R44

    R44 Asperger's Network? Absolutely.

    1,071
    167
    +415
    But let's be clear - ASP tags are rarely used in PHP, and short tags seem to be used more.
     
Verification:
Draft saved Draft deleted
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.