rudy.siregar Posted March 19, 2008 Share Posted March 19, 2008 Hello all, How can i make a function, which used to get a value of unique number contains of 5 digit numeric . The unique characters would be "ORDER ID" (in my web), so that must be different each order. The format of ORDER ID is like this : #OCCxxxxx (xxxxx = number that always be randomize), so that would be #OCC00148 or #OCC00045 etc. Can u help me to find the way how make it? Pls give me some idea or code. Thank You. Regards, Rudy Link to comment https://forums.phpfreaks.com/topic/96840-help-me-pls-how-to-make-unique-function/ Share on other sites More sharing options...
keeB Posted March 19, 2008 Share Posted March 19, 2008 srand(microtime()); $val = md5(rand()); $start = rand(0, 27); //32 - 5 $str = "#OCC" . substr($val, $start, 5); print $str ?> Link to comment https://forums.phpfreaks.com/topic/96840-help-me-pls-how-to-make-unique-function/#findComment-495612 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.