Unique id to be generated through php

I want a id to be generated in php The Id has to be started from AB0001. And when 10th row inserts the Id has to be AB0010. How can I generate the id this way in php.
In my code the id will be generated in this way

$id=”AB000″.mysqli_insert_id($con);

I want The id to be only 5 letters. Not more than that.

The Id has to be started from AB0001. And when 10th row inserts the Id has to be AB0010. Only 5 digit Id has to be generated