Difference between require and include
| From: | (Jürgen Freundel) | Date: | Fri, 29 Mar 2002 12:41:40 +0000 |
| Subject: | Difference between require and include | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969343814@lists.php.net to get a copy of this message | ||
Hey;
i have tried to find the difference in use of require and include.
In my example I can't find any:
test.php:
<html>
<body>
<h2>test with require</h3>
<?
$wahr = true;
$falsch = false;
echo "<b>require with true</b><br>";
if ($wahr) require("requiret.inc");
echo "<b>require with false</b><br>";
if ($falsch) require("requiref.inc");
echo "<b>require in a loop</b><br>";
for($z=1;$z<=5;$z++){
require("require$z.inc");
}
?>
</body>
</html>
The requireX.inc have the structure:
<?
echo "$z: answer from require$z.inc<br>";
?>
In the documentation is written, that it does not works, but the result is
in the attachment.
Im working with Windows 98, Apache 1.3.22 and PHP 4.0.6 in CGI-mode
With best regards
Jürgen Freundel
Attachment: [image/gif] test.gif
Attachment: [image/gif] test.gif