$first = "Text 1"
$second = "Text 2"
$third = "Text 3"
$fourth = "Text 4"
$fifth = "Text 5"
我想创建一个函数,它显示$ second和$第四次的次数比其他变量多3倍。显示变量恰好是其他变量的3倍
如何做到这一点?
$first = "Text 1"
$second = "Text 2"
$third = "Text 3"
$fourth = "Text 4"
$fifth = "Text 5"
我想创建一个函数,它显示$ second和$第四次的次数比其他变量多3倍。显示变量恰好是其他变量的3倍
如何做到这一点?
$arr = array($first, $second, $second, $second, $third, $fourth, $fourth, $fourth, $fifth);
$elem = $arr[array_rand($arr)];
这会从数字到您的变量
值我试着用概率工作,但发现了,这是不是我想要的,因为它是随机的是被选择哪些文本。所以现在我被困在做什么。 – Emil
我不明白你的问题 – David
他们出现的顺序有关系吗? – andrewsi