Home  >  Article  >  Backend Development  >  下面代码正确的应该如何写

下面代码正确的应该如何写

WBOY
WBOYOriginal
2016-06-13 11:45:04931browse

下面代码正确的应该怎么写

$a = "'111','222','333','1111','2222','3333','1112','2221','33313','1114','2225','3336'";<br /><br />echo $a;<br />srand((float) microtime() * 10000000);<br />$input = array($a);<br />$rand_keys = array_rand($input, 10);<br />echo $input[$rand_keys[0]].','.$input[$rand_keys[1]].','.$input[$rand_keys[2]].','.$input[$rand_keys[2]].','.$input[$rand_keys[4]].','.$input[$rand_keys[5]].','.$input[$rand_keys[6]].','.$input[$rand_keys[7]].','.$input[$rand_keys[8]].','.$input[$rand_keys[9]];


<br />srand((float) microtime() * 10000000);<br />$input = array('111','222','333','1111','2222','3333','1112','2221','33313','1114','2225','3336');<br />$rand_keys = array_rand($input, 10);<br />echo $input[$rand_keys[0]].','.$input[$rand_keys[1]].','.$input[$rand_keys[2]].','.$input[$rand_keys[2]].','.$input[$rand_keys[4]].','.$input[$rand_keys[5]].','.$input[$rand_keys[6]].','.$input[$rand_keys[7]].','.$input[$rand_keys[8]].','.$input[$rand_keys[9]];



为什么上面这段代码错误,下面代码正确呢

请问上面这段正确的应当怎么写

知道的高手请直接给代码,谢谢了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn