December 2002
Intermediate to advanced
496 pages
9h 40m
English
There are several ways to embed PHP code into HTML documents. One way is to put the PHP code within the tags <? ... ?>:
<? echo "hello, world!"; ?>
Most PHP programmers choose this syntax. If PHP is combined with XML, however, there are conflicts with this syntax. In XML the <? ... ?> construct is a special thing called a processing instruction. If PHP and XML are needed in the same file, one can use the alternative PHP tag <?php ... ?>:
<?php echo "hello, world!"; ?>
Some HTML editors (such as FrontPage) don’t like processing instructions, so another alternative is to use the <SCRIPT> tag. This is the syntax:
<SCRIPT LANGUAGE="php"> echo "hello, world!"; </SCRIPT>
And last but not least, the final way is ...
Read now
Unlock full access