I hope this is what you are looking for.
This function will return a unique id in the following format:
MMDD followed by some random numbers (i.e. 12174533321).
Be sure to make the ID field in your database a BIGINT NOT NULL UNIQUE.
Also, you should definitely run a check to ensure that the id generated doesn't already exist.
Let me know if this is not what you are looking for.
function generate_id()
{
mt_srand(time());
return date("md").mt_rand("1000000", "9999999");
}