My questions is somewhat based off this: How can I get the last 7 characters of a PHP string?
Mine is similar. I need to get the last x characters of a string and to stop when I reach "-"
for example, I have a booking code: N-903
and I can get the last 3 characters like so:
$booking_Code = N-903
$booking_Code = substr($booking_Code, -3);
and the result will be:
903
This number however will increase, so I expect to see booking codes like:
N-1001
N-22520
N-201548
so the code:
substr($booking_Code, -3);
would become useless. Is there any way to use "-" as a delimiter? I think that's the correct term to use. because the number that's generated will always come after the hyphen "-". Any help would be greatly appreciated