Home » , » Random without duplicate

Random without duplicate

(Feb 13, 2011)

with this script we can make random without duplicate. We use function shuffle to random array.
then looping that array to get random as much as we want.

<?php

$array_word=array('a','b','c','d','e','f','g','h','i','j','k',
'l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');

shuffle($array_word);
reset($array_word);

$no=0;
foreach($array_word as $line)
{
$random.=strtoupper($line);
$no++;
if ($no >= 6) break;
}

echo $random;
?>

Posted in Label: ,  

0 komentar:

Post a Comment


 

Script Language



© 2011 Script31 - All Rights Reserved


TopOfBlogs Computers Blogs