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 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; 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 Link to comment https://forums.phpfreaks.com/topic/188713-rand-with-prefix-help/#findComment-996210 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.