I am creating a merry-go-round, where you will have 3 sliders containing 15 images within each one, totaling 45 images.
I'vecreatedanassociativearraytodisplaytheseimagesrandomly,sofarsogood,however,nowIneedthefirst15itemstobefixed,whereIcanchoosewhichindexesaredisplayedfirstandtheother30aredisplayedrandomlybutwithoutrepeatingtheonesIchose.
$clientes=array(array("nome" => "Cliente 1",
"categoria" => "Turismo",
"logo" => "turismo.jpg"
),
array(
"nome" => "Suporte",
"categoria" => "Tecnologia",
"logo" => "suporte.jpg"
),
array(
"nome" => "Faculdade Futura",
"categoria" => "Educação",
"logo" => "faculdade-futura.jpg"
),
shuffle($clientes);
foreach (array_slice($clientes, 0, 45) as $atributo => $valor):
echo "{$valor["nome"]}";
endforeach;
);
This my array has more than 60 items, where it is displayed elsewhere on the site, but on the carousel I only need 45, so I used array_slice()
.