1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| function create_random_array()
{
$lenarray = rand(20, 100);
$array = array();
$o = 0;
for ($i=0; $i <= $lenarray; $i++)
{
if (rand(1, 5) == 1)
{
$second_lenarray = rand(20, 50);
for ($u[$o]=0; $u[$o] <= $second_lenarray; $u[$o]++)
{
$color1 = substr(str_shuffle('abdc0123456789'), 0, 6);
$color2 = substr(str_shuffle('abdc0123456789'), 0, 6);
$color3 = substr(str_shuffle('abdc0123456789'), 0, 6);
if (rand(1, 5) == 1)
{
boucle($u[$o], $i);
}
else
{
$array_second[$u[$o]] = '<font color="'.$color1.'">valeur</font> <font color="'.$color2.'">'.$i.'</font>';
$array_second[$u[$o]] .= '<font color="'.$color1.'">-</font><font color="'.$color3.'">'.($u[$o]).'</font>';
}
}
$array[$i] = $array_second;
}
else {
$color1 = substr(str_shuffle('abdc0123456789'), 0, 6);
$color2 = substr(str_shuffle('abdc0123456789'), 0, 6);
$array[$i] = '<font color="'.$color1.'">valeur</font> <font color="'.$color2.'">'.$i.'</font>';
}
}
return $array;
}
function boucle($o, $i) {
$o = $o++;
$second_lenarray = rand(20, 50);
for ($u[$o]=0; $u[$o] <= $second_lenarray; $u[$o]++)
{
$color1 = substr(str_shuffle('abdc0123456789'), 0, 6);
$color2 = substr(str_shuffle('abdc0123456789'), 0, 6);
$color3 = substr(str_shuffle('abdc0123456789'), 0, 6);
if (rand(1, 5) == 1) {
boucle($u[$o], $i);
} else {
$array_second[$u[$o]] = '<font color="'.$color1.'">valeur</font> <font color="'.$color2.'">'.$i.'</font>';
$array_second[$u[$o]] .= '<font color="'.$color1.'">-</font><font color="'.$color3.'">'.($u[$o]).'</font>';
}
}
$array[$i] = $array_second;
} |
Partager