egturnkey Posted March 15, 2010 Share Posted March 15, 2010 Hello friends, If we have the following files . x.php y.php z.php and main file index.php I want a code where i write it in index.php so that, it loads in random way btween ( x.php-y.php-z.php ) i mean random files loading. how can it be ? Link to comment https://forums.phpfreaks.com/topic/195313-random-files-load/ Share on other sites More sharing options...
aeroswat Posted March 15, 2010 Share Posted March 15, 2010 Hope you aren't from an English speaking country Anywho I would just store the values of the file names in an array and shuffle the array. Link to comment https://forums.phpfreaks.com/topic/195313-random-files-load/#findComment-1026345 Share on other sites More sharing options...
egturnkey Posted March 15, 2010 Author Share Posted March 15, 2010 Hope you aren't from an English speaking country Anywho I would just store the values of the file names in an array and shuffle the array. Well, yes that is right, i'm not english man i'm from egypt anyway i mean, how can i add <? include_once("x.php"); ?> but make it in random way so it meight be x.php and next time be y.php and next z.php ..ect ( random ) hope you got what i've ment Link to comment https://forums.phpfreaks.com/topic/195313-random-files-load/#findComment-1026349 Share on other sites More sharing options...
aeroswat Posted March 15, 2010 Share Posted March 15, 2010 Hope you aren't from an English speaking country Anywho I would just store the values of the file names in an array and shuffle the array. Well, yes that is right, i'm not english man i'm from egypt anyway i mean, how can i add <? include_once("x.php"); ?> but make it in random way so it meight be x.php and next time be y.php and next z.php ..ect ( random ) hope you got what i've ment Put all of your file names in an array $arr = array('x.php', 'y.php', 'z.php'); Shuffle your array shuffle($arr); Load the first value in your array include_once($arr[0]); Link to comment https://forums.phpfreaks.com/topic/195313-random-files-load/#findComment-1026353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.