- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Wed, 29 Jul 2009 14:05:28 +0200
- To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
- Cc: public-html <public-html@w3.org>
Daniel Glazman wrote: > Toby A Inkster wrote: > >> <p class="<?php echo 'foo';?>"> >> >> Invalid in both XHTML and HTML, but perfectly legal PHP. PHP's start >> and end markers are not real XML processing instructions. They just >> look a bit like them. > > They are real processing instructions and the current PHP start marker > <?php was not the one early versions of PHP used. It was changed to > match SGML/XML PIs to allow editability in markup editors and wysiwyg > editors. No, while it has been successfully demonstrated that the chosen syntax was largely inspired by PIs, PHP itself does not use either SGML or XML processing and, as shown multiple times in this thread, does not even fully conform with the syntax of either. Pretending otherwise doesn't do anyone any good. Rather, PHP's use of the <?php ?> syntax (and the older <? ?> syntax) is simply analogous to ASP's and JSP's use of the <% %> syntax. It's a distinct syntax that can be used together with HTML/XML fragments, that requires pre-processing in order to output either. Although, PHP certainly isn't limited to outputting just HTML or XML, it can output anything. Are you concerned that the <?php ?> syntax is invalid in CSS, though it can quite easily be used to output CSS files like this? <?php header("Content-Type: text/css; charset=UTF-8"); $mycolor = "#F63" ?> h1 { color: <?php echo $mycolor; ?>; } ... Why should it matter that <?php ?> is technically invalid HTML/XML, but not that it's also invalid CSS, JS, or any other language? > Breaking that compatibility is, IMHO, a serious error. We're not breaking compatibility. PHP never had any real compatibility, in the sense you are claiming, with HTML, SGML or XML. We're just clearing up the fiction about PHP itself being conforming HTML, or even SGML or XML for that matter. -- Lachlan Hunt - Opera Software http://lachy.id.au/ http://www.opera.com/
Received on Wednesday, 29 July 2009 12:06:11 UTC