I have an array $blocks It has 4 items with constant values A, B, C, D
$blocks["a"] = 20;
$blocks["b"] = 1000;
$blocks["c"] = 10000;
$blocks["d"] = 50000;
Another function returns a value, lets say 358020 (It's usually high but can drop to a few tens
How would I write a function that will take this value and return an array of how many of each item exists.
Example output something like:
$output["a"] = 1;
$output["b"] = 3;
$output["c"] = 0;
$output["d"] = 7;
Starting with the largest block, how many of that block fits into the value, then the remainder is passed to the next largest, and so on...