Hello Dear Php Experts, I Need Some Help, Look, $key = "2a587s45"; I Want to add more keys randomly, look, here some keys, 25d25484d2 | 58s8ee2d6dd5 | yycd8fgg1 | 2a587s45 I want to add these in $key = randomly Any Idea ?
$list = array("one", "two", "three"); $random_item = $list[rand(0, count($list) - 1)]; echo $random_item; PHP: If those keys come as a string: $keys = "25d25484d2 | 58s8ee2d6dd5 | yycd8fgg1 | 2a587s45"; $list = explode(" | ", $keys); $random_item = $list[rand(0, count($list) - 1)]; echo $random_item; PHP:
To add on to what ActiveFrost said you need to seed the rand() generator to ensure that the number is unique and not following a pattern. Read here: http://php.net/manual/en/function.srand.php
ThaNks, And any idea about line wise ? 1st 25d25484d2 show, then 58s8ee2d6dd5 after that yycd8fgg1 and last 2a587s45 ..