On Jul 26, 2009, at 5:17 AM, Rasmus Lerdorf wrote:
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.
I prefer strong namespacing of all my tags. "<?" and "<?=" are highly
generic and could be usurped by any other (admittedly finctional so
far) processing system run on the file.
As I said, it was just for the heck of it :). I know no one's likely
to find it interesting.
I did toy with the idea of something that was actually compliant, but:
<?php. - is not visually distinctive
<?php- - same
<?php.e - saves very little typing and is ugly
<?phpe - mucks with the entire idea of being namespaced
<?php e - visually confusing and saves little typing
And so forth.
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