Auto increment numbers in php

I’ve never seen receipt numbers that include the date like that, I’ve just seen sequentially numbered receipts. I don’t know if this will work for you, but worth a shot:


$rtno = date("md").str_pad($id, 3, "0", STR_PAD_LEFT);

Where $id is your auto_increment column from your database. This of course won’t restart at 1 each day, but otherwise it does match what you’ve described I believe.