Jump to content

help with reference number generation!


debuitls

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.