Jump to content
php.lv forumi

Include & Require


Ugga

Recommended Posts

Nu es te 1999 gada ebūku lasu un tur ir sekojošs teksts:

 

.....The include statement also accesses an external file of code, but it evaluates and executes the code in
the external file each time that the include statement is encountered, rather than just replacing itself
with the external code once at the beginning of execution. Suppose we have three files, named
file1.php, file2.php and file3.php, which contain code we want to include in another PHP
pahe. With include, we can do this:

for ($i = 1; $i <= 3; ++$i) {
include("file" . $i . ".php");
}
If we tried this with require, the contents of file1.php would replace the require statement on
the first iteration of the loop, and that code would thus be re-executed on the subsequent iterations.........

 

Bet tur bija arī piebilde, ka kopš PHP4 tas tā vairs nav.

 

Vnk interesanti. ;)

Link to comment
Share on other sites

×
×
  • Create New...