Well, I have the following list of answers taken from my database. And for the right question not to be in the same place, I did a random to show the results randomly. But the problem is that by listing, the results also repeat themselves, and I did not want such a thing to happen itself.
I would appreciate any help so that when doing the random, the results did not repeat themselves.
And how can I post a response, since I have them dynamically?
$radioname = "pergunta-" . $row['idPergunta'];
$items =[
$row['RespostaCorrecta'],
$row['RespostaErrada1'],
$row['RespostaErrada2'],
$row['RespostaErrada3'],
];
$rand_items = [
$items[rand(0, count($items) - 1)],
$items[rand(0, count($items) - 1)],
$items[rand(0, count($items) - 1)],
$items[rand(0, count($items) - 1)],
];
echo <<<HTML
<fieldset name='pergunta-$radioname' id='pergunta-$radioname' >
<input type='radio' required name='pergunta-$radioname' id='pergunta-$radioname' > {$rand_items[0]}
<input type='radio' required name='pergunta-$radioname' id='pergunta-$radioname' > {$rand_items[0]}
<input type='radio' required name='pergunta-$radioname' id='pergunta-$radioname' > {$rand_items[0]}
<input type='radio' required name='pergunta-$radioname' id='pergunta-$radioname' > {$rand_items[0]}
</fieldset>
HTML;