Using include() Within a Loop : include « Utility Function « PHP






Using include() Within a Loop

 
<html>
<head>
<title>Using include() Within a Loop</title>
</head>
<body>
<div>
<?php
for ( $x=1; $x<=3; $x++ ) {
 $incfile = "incfile".$x.".txt";
 print "<p>";
 print "Attempting include $incfile<br/>";
 include( "$incfile" );
 print "</p>";
}
?>
</div>
</body>
</html>
  
  








Related examples in the same category

1.Behavior of Files Included Using include
2.Including Other Files
3.Including files relative to the current file
4.Using include to Load Files in PHP
5.Using include() to Execute PHP and Assign the Return Value