我目前有一段代码从数组中选择随机值,但我想防止它选择重复值。我怎样才能做到这一点?到目前为止,这是我的代码:
$facilities = array("Blu-ray DVD Player","Chalk board","Computer", "Projector",
"Dual data projector", "DVD/Video");
for($j = 0; $j < rand(1, 3); $j++)
{
$fac = print $facilities[array_rand($facilities, 1)] . '<br>';
}