Skip to content

PHP XML opening and closing tag

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

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

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 used XSL to generate a lot of our HTML (and PHP) documents.