Array is just a fancy name for list. For example, in the array I made, you had a list of items with labels and values.
- "tires" with the label "tireqty"
- "bottles of oil" with the label "oilqty"
Then the foreach loop just goes through each one of the lists, separating them into two variables - the label and the value it holds. The trick comes when I use "$$variable". That's a special notation, it means to look at the value of $variable, and then take the value of the variable with THAT name. That's a complicated sentence, so here's what I mean.
Let's say $variable = "tireqty". $$variable would then look at the value of $variable (which is "tireqty") and then get the value of $tireqty. The foreach loop just does that for all of the labels in the array.
I hope that all makes sense.