M-ai pus in ceata,
Am wampserver cu PHP Version 5.5.12
nu stiu cum sa le bag in sub array, Daca am mai multe variante si in subarray vede doar 3 variante,
//De aici ii traseul numerelor din baza de date $rand['varianta'] si le scoate asa :
8 , 10 , 18 , 23 , 33 + 8 , 11
24 , 27 , 30 , 36 , 39 + 2 , 11
6 , 14 , 21 , 39 , 49 + 3 , 7
11 , 20 , 23 , 33 , 45 + 3 , 5 // sunt 4 variante
Cod: Selectaţi tot
//formatare numere afisate in tabel
$oldNumberDesignx = $rand['varianta']; //Sunt din baza de date
$oldNumberDesignxx = str_replace('+ ', ',', $oldNumberDesignx);
$oldNumberDesign = $oldNumberDesignxx;
$arr = explode(',', $oldNumberDesign);
$newDesignNumber = "<div class='lottery_ball_1'>$arr[0]</div><div class='lottery_ball_1'>$arr[1]</div><div class='lottery_ball_1'>$arr[2]</div><div class='lottery_ball_1'>$arr[3]</div><div class='lottery_ball_1'>$arr[4]</div><div class='lottery_stars_1'>$arr[5]</div><div class='lottery_stars_1'>$arr[6]</div>";
//////////////
//$mynumers = $arr[0] . $arr[1] . $arr[2] . $arr[3] . $arr[4] . "-" . $arr[5] . $arr[6] . "<br>";
//echo $mynumers;
// numere extrase
$nr_extrase = [
'bile'=> [23, 34, 11, 44, 42], // principale
'star'=> [2, 9] // norocoase
];
// numere adaugate
$nr_user = [
'bile'=> $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], // principale
'star'=> $arr[5], $arr[6] // norocoase
];
// numere comune
$nr_comune = [
'bile'=> array_intersect($nr_extrase['bile'], $nr_user['bile']),
'star'=> array_intersect($nr_extrase['star'], $nr_user['star'])
];
//var_export($nr_comune)
$numere_bile =$nr_comune['bile'];
$numere_star =$nr_comune['star'];
foreach(array_merge($numere_bile, $numere_star) as $biles) {
echo $biles."\n";
}
Daca pun echo afara din []
Cod: Selectaţi tot
$nr_user = [
'bile'=> array($arr[0], $arr[1], $arr[2], $arr[3], $arr[4]), // principale
'star'=> array($arr[5], $arr[6]) // norocoase
];
echo $arr[0];// imi arata prima coloana 8, 24,6,11
si in interior nu mi le pune
Mersi