I have a numeric string and I'd need to split it in groups of 2 starting from right, but not more than three groups.
To understand, the 3 groups are 'copper', 'silver' and 'gold' and the starting value is a synthetic money amount. For example:
10 -> 10 copper
1010 -> 10 silver and 10 copper
102030 -> 10 gold, 20 silver and 30 copper
1234567891010 -> 123456789 gold, 10 silver and 10 copper
how to do it in php?