I have a simple problem that I want to make some code where it is not possible for it to print two identical variables like:
2.php
2.php
3.php
it should only mix them instead as the 3 files change location every time but does not repeat itself.
a correct answer is:
4.php
2.php
3.php
and
3.php
4.php
2.php
The code looks like this:
<?php
$first = '2.php';
$second = '3.php';
$third = '4.php';
$array = array($first, $second, $third);
for ($i=0; $i<3; $i++) {
echo $array[rand(0, count($array) - 1)] . "\n";
}