0

AB is an receipt code should be constant next (08 todays date) and 10001 is receipt num?

yashu
  • 1
  • 2

3 Answers3

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're sure there always will be 4 characters in front of the receipt number, you could of course use substr:

$data = 'AB0810001';
$receipt = substr($data, 4);
echo $receipt;  // will output 10001
Havelock
  • 6,913
  • 4
  • 34
  • 42
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