AB is an receipt code should be constant next (08 todays date) and 10001 is receipt num?
Asked
Active
Viewed 161 times
0
-
1are you storing the receipt codes in database? – air4x Oct 08 '12 at 09:28
-
possible duplicate of [MySQL Auto Increment Custom Values](http://stackoverflow.com/questions/5228408/mysql-auto-increment-custom-values) – Madara's Ghost Oct 08 '12 at 09:31
3 Answers
1
$prefix = 'AB';
$today = date("d");
$receipt_num = '10001';//from db value
echo $prefix.$today.$receipt_num;

iLaYa ツ
- 3,941
- 3
- 32
- 48
0
If you mean how to get those chunks from that string this should do it:
var str = 'AB0810001';
var result = str.match(/([A-Z]{2})(\d{2})(\d{5})/);
result.shift();
console.log(result); //=> ['AB', '08', '10001']

elclanrs
- 92,861
- 21
- 134
- 171