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! Link to comment https://forums.phpfreaks.com/topic/172398-help-with-reference-number-generation/ 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); Link to comment https://forums.phpfreaks.com/topic/172398-help-with-reference-number-generation/#findComment-908965 Share on other sites More sharing options...
debuitls Posted August 29, 2009 Author Share Posted August 29, 2009 Thanks Ignace. Thats a big help! Link to comment https://forums.phpfreaks.com/topic/172398-help-with-reference-number-generation/#findComment-908979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.