PHPBuilder - Multiple page includes with random order



RSS Twitter
Snippets Algorithms

Multiple page includes with random order

by: Richard Quick
|
December 31, 2000

Version: 1

Type: Function

Category: Algorithms

License: GNU General Public License

Description: This script includes 7 files in a random order. The files are named thisfile1.php3 through to thisfile7.php3. To change the number of files modify $i<=7. To change the initial part of the name or the extension change "thisfile".$value.".php3"



<?php

srand(time()); 
for ($i=1; $i<=7; $i++) { 
        $r = rand(); 
        $a[$r]=$i; 
} 
ksort($a); 
while (list($key,$value)=each($a)) { 

	$rqfilename = "thisfile".$value.".php3";
	include($rqfilename);
}

?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Richard Quick

Comment:



Comment:

(Maximum characters: 1200). You have characters left.