Auto-increment alphanumeric numbers in php

Hi all,

I am developing invoice template.Can anyone suggest me how to auto-increment invoice number which may be alphanumeric number like “aaaa123”,“awrewr11”…

$x = "abc123";
$x++;
print "$x\
";

Should read abc124.

In a word. Don’t.

More often that not, it’s only ever used when presenting the data. Use a regular incrementing key and build the reference as required.


SELECT CONCAT(
    id,
    '-',
    customer.code,
    '-',
    other.field
) AS reference FROM table;