PHP 怎么随机获取数组里面的值

注意array_rand随机返回的是KEY值的集合

<?php
srand((float) microtime() * 10000000);
$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2);
print $input[$rand_keys[0]] . "
";
print $input[$rand_keys[1]] . "
";
?>
原文地址:https://www.cnblogs.com/kenshinobiy/p/4739520.html