[thelist] Re: php & xhtml, escaping

Tim Luoma luomat at peak.org
Wed Jul 17 21:40:01 CDT 2002


Tom Dell'Aringa wrote:
> Hi all,
>
> I'm just getting better acquainted with PHP and running through the
> docs. I first noted that the manual says you can use ASP style tags
> "<% %>" which I liked since my editor is set up for them
> automatically (no big deal to change it though.) Then I read:
>
> "The first way, <?php. . .?>, is the preferred method, as it allows
> the use of PHP in XML-conformant code such as XHTML."
>
> Does this mean you must do <?php evertime or it won't validate - the
> manual doesn't seem to go into detail about it.

You can indicate inline PHP in 3 ways:

<%  %>
<?   ?>
<?php ?>

<?php  ?> is the XML way because it describes the type of code going in
there much like the beginning of the XHTML doctype:

<?xml version="1.0" encoding="UTF-8"?>

I prefer <?php because it reminds me what syntax I'm using ;-)

TjL, who now is constantly making the mistake of defining variables in
/bin/sh scripts like this:

$foo = bar

TjL







More information about the thelist mailing list