the easiest: $isInUse = 0 ; while ($isInUse == 0) { $yourNumber = rand(0,9) . rand(0,9) . rand(0,9) .... (8 times)
/* check here if $yourNumber is already in use and save the value in $isInUse */ } without saving the previous you will never be sure if you have duplicates best, fernando On Mon, Mar 9, 2009 at 10:56 PM, chad qian <nynj.t...@hotmail.com> wrote: > Hi, > I need to generate random 8-digit numbers continuously.And no > duplication among all those numbers.In other word,every single 8-digit > number must be unique.How to do php programming? > > Thanks a lots! > > chad > > ------------------------------ > Express your personality in color! Preview and select themes for HotmailĀ®. See > how.<http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme> > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show_participation.php >
_______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show_participation.php