Définition officielle pour PHP 3.0
Il existe 3 variantes (équivalentes pour HTML):
<? echo("this is the simplest, an SGML processing instruction\n"); ?>
XML compatible: <?php ..... ?>
<?php echo("if you want to serve XML documents, do like this\n"); ?>
Pour survivre avec FrontPage: <script>
<script language="php"> echo("some editors (like FrontPage) don't like processing instructions"); </script>
permet d'inclure le contenu d'un fichier au moment ou l'instruction est évaluée
Exemple: include("style.text");
permet d'inclure le contenu d'un fichier au moment où le fichier php est chargé
Exemple: require("mes_fonctions.lib");
<HTML> <HEAD> <TITLE>Simple Include Demo (21-Apr-1998)</TITLE> <? include("style.text"); ?> </HEAD> <BODY> <H1>Simple Include Demo</H1> In this file we include a <A HREF="style.text">style sheet</A> and a <A HREF="footer.text">footer</A>. <P> Look at <A HREF="include1.phps">the formatted source</A> or the <A HREF="include1.source">unformatted one</A> if you want to know how this is done. <H1>Yet another styled title</H1> <UL> <LI> bullet item </LI> <LI> bullet item </LI> </UL> <? /* A footer */ include("footer.text"); ?> </BODY> </HTML>