lundi 4 novembre 2019

Incremental number with specific format

I need to make an id with a specific format where 2 first digit are year, and the rest are just incremental number with 000 as spacer between year and incremental number where the qty of 0 will decrease along with increasingly incremental number such as 190001,190002,.....,190180,...,191400. All i can think of using

$id = '';
if(srtrlen($number) == 1){
   $id = date('y',time()).'000'.$number;
}
elseif(strlen($number)==2){
   $id = date('y',time()).'00'.$number;
}
.
.
.
else{
   $id = date('y',time()).$number;
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire