0
I’m creating a carousel, where there will be 3 sliders containing 15 images inside each, totaling 45 images.
I created a array associative to display these images randomly, so far so good, however, now I need the first 15 items to be fixed, where I can choose which indexes are displayed first and the other 30 are displayed randomly but without repeating those 15 that I chose.
$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;
);
That one of mine array has more than 60 items, where it is displayed in another part of the site, but in the carousel only need 45, so I used the array_slice()
.
I’m sorry if I ended up causing a confusion rs Actually the first 15 that will be fixed I will choose, now how will I choose is that I do not know, I think the easiest way is by the index, or else create an attribute.
– Sérgio Machado