debuitls Posted August 29, 2009 Share Posted August 29, 2009 Hi, I'm trying to generate a random reference code for an auction style website. Currently I'm using the following which generates a random ten character code. *This is not my code i found it elsewhere on the net. $random = substr(base64_encode(rand(1000000,9999999)),0,7); This is fine but what I really need is do is add 'DAD' before each random seven character code. So in other words my reference code would be ten characters long ie DAD1234567 Just wondering if anybody had any suggestions off the top of their heads. Many Thanks! Quote Link to comment Share on other sites More sharing options...
ignace Posted August 29, 2009 Share Posted August 29, 2009 $random = 'DAD' . substr(base64_encode(rand(1000000,9999999)),0,7); Quote Link to comment Share on other sites More sharing options...
debuitls Posted August 29, 2009 Author Share Posted August 29, 2009 Thanks Ignace. Thats a big help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.