Check demo Codeviper , try this easiest way,
PHP
<?php
$input = array("1.php", "2.php", "3.php", "4.php", "5.php");
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n"; /* include $input[$rand_keys[0]]; */
echo $input[$rand_keys[1]] . "\n"; /* include $input[$rand_keys[1]]; */
?>
include() - behavior occur warning so the rest of the script will still execute.
require() - behavior occur fatal error, which stops execution immediately.
So in this case you should use include()
function instead of required()
function,
Final PHP code,
<?php
$input = array("1.php", "2.php", "3.php", "4.php", "5.php");
$rand_keys = array_rand($input, 2);
include $input[$rand_keys[0]];
include $input[$rand_keys[1]];
?>