我正在使用以下教程来学习如何在 PHP 中洗牌,但输出很难看。如何更改随机播放的输出以更符合我想以列表格式显示的投票?
我正在使用以下教程来学习如何做到这一点:
http://www.w3schools.com/php/func_array_shuffle.asp
<?php
$my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse");
shuffle($my_array);
print_r($my_array);
?
但是输出很难看: Array ( [0] => Cat [1] => Dog [2] => Horse )
如何使随机播放数组看起来像这样漂亮?
<ul>
<li><input id="pollRadioButton1" name="pollAnswerID" type="radio" value="1" /> Answer1 for Poll1</li>
<li class="pollChart pollChart1"> </li>
<li><input id="pollRadioButton2" name="pollAnswerID" type="radio" value="2" /> Answer2 for Poll1</li>
<li class="pollChart pollChart2"> </li>
</ul>