代码中的问题;
<?php
/*
* @array
*/
$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2); //What does the two mean?
echo $input[$rand_keys[1]] . "\n"; //What does the 1 stand for? and Why do I have to define $input again if it was defined in $rand_keys?
?>
这些数字是什么意思?谢谢。
编辑:
我努力了:
$input = array("test", "test2", "test3", "test4");
$rand_keys = array_rand($input, 2);
$echo = $input[$rand_keys[0]];
echo $echo;
它显示到test3。我只在数组 rand 中做了 2 个。为什么显示3?