PHP XML opening and closing tag

Published: Tuesday, 7 June 2005
php xml

You can use the following xml like tags instead of <% and %>

<script language="php">
// php script goes in here.

Note that this isn’t XHTML compliant as the script tag requires a ‘type’ attribute, so using this tag in the HTML and hoping it’ll pass the XHTML validator does not work. I’ve tried adding a type attribute to the script tag, but then PHP did not parse the script at all.

This kind of tag is still useful as we use XSL to generate alot of our HTML (and PHP) documents.