With the following array
$ar = array (
//color, amount, 1/0
"red,10,0",
"red,20,1",
"red,30,0",
"red,40,1",
//"red,n,0 or 1" n: means infinite
"blue,10,0",
"blue,20,1",
"blue,30,0",
"blue,40,1",
//"blue,n,0 or 1" n: means infinite
);
I would have a function with the following echo
if color=red && amount=10 then 0
if color=red && amount=11 then 1
if color=red && amount=20 then 1
if color=red && amount=21 then 0
...
if color=blue && amount=25 then 0
many thanks