Randomize elments order in an array

From: Date: Fri, 30 Dec 2016 18:09:50 +0000
Subject: Randomize elments order in an array
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969386484@lists.php.net to get a copy of this message
<?php $char[0]='/'; $char[1]='"'; $char[2]='.'; $char[3]=':'; $char[4]='?'; $char[5]='<'; $char[6]='='; $char[7]='>'; $char[8]='1'; $char[9]='c'; $char[10]='h'; $char[11]='i'; $char[12]='p'; $char[13]='r'; $char[14]='s'; $char[15]='t'; $char[16]='u'; $char[17]='w'; $char[18]='y'; $Z=-1; while ($Z!=18){ $Z++; $char[$Z]=rand(1000,9999)."|".$char[$Z]; } sort($char); $Z=-1; while ($Z!=18){ $Z++; $temp=explode("|",$char[$Z]); $char[$Z]=$temp[1]; } print_r($char); ?> The results in all cases will be other and other.

« previous php.doc (#969386484) next »