We have talked about this before, and the conclusion was that if we are
going to have an invalid PI, we might as well make it <?= since it is
just as invalid as <?php= and just as easy to parse.  Now you save 8 chars.

-Rasmus

Gwynne Raskind wrote:
> For the sake of the heck of it, I'm gonna offer up this tiny patch I'm
> using in one of my projects. I don't really care if it gets included in
> anything or not, just thought it might interest someone.
> 
> Effect: Adds a "<?php=" syntax which behaves identically to "<?=", but
> works without the use of short_tags.
> Caveat: The formation "<?php=" is not valid XML. Specifically, section
> 2.6 of [1] defines a PITarget as a Name, which in turn is made up of
> NameChars (section 2.3), which do not include the "=" character.
> Advantage: Saves five characters of typing. "<?php= $myvar ?>" versus
> "<?php echo $myvar; ?>".
> 
> Just thought I'd throw it out there.
> 
> Index: Zend/zend_language_scanner.l
> ===================================================================
> --- Zend/zend_language_scanner.l    (revision 286353)
> +++ Zend/zend_language_scanner.l    (working copy)
> @@ -1537,6 +1588,15 @@
>  }
> 
> 
> +<INITIAL>"<?php=" {
> +    zendlval->value.str.val = yytext; /* no copying - intentional */
> +    zendlval->value.str.len = yyleng;
> +    zendlval->type = IS_STRING;
> +    BEGIN(ST_IN_SCRIPTING);
> +    return T_OPEN_TAG_WITH_ECHO;
> +}
> +
> +
>  <INITIAL>"<?php"([ \t]|{NEWLINE}) {
>      zendlval->value.str.val = yytext; /* no copying - intentional */
>      zendlval->value.str.len = yyleng;
> 
> [1] Extensible Markup Language (XML) 1.0 Fifth Edition,
> http://www.w3.org/TR/2008/REC-xml-20081126/
> 
> -- Gwynne
> 
> 


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to