01hanstu Posted January 16, 2010 Share Posted January 16, 2010 Hi, I am trying to generate a random number for our support system. I am trying to get it so that there is a fixed prefix i.e. 30038 (Customer ID) then a random number between 0000 - 9999 so the call numbers would look like this :300380098. Anyone Help Thank - Stuart Quote Link to comment https://forums.phpfreaks.com/topic/188713-rand-with-prefix-help/ Share on other sites More sharing options...
wildteen88 Posted January 16, 2010 Share Posted January 16, 2010 $customerID = 30038; $randNumber = sprintf("%d%04d", $customerID, rand(0, 9999)); echo $randNumber; Quote Link to comment https://forums.phpfreaks.com/topic/188713-rand-with-prefix-help/#findComment-996204 Share on other sites More sharing options...
01hanstu Posted January 16, 2010 Author Share Posted January 16, 2010 Hi, Thanks for that, brilliant. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/188713-rand-with-prefix-help/#findComment-996210 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.