There are 3 boxes:
You can put either
0 in each box
The possible outcomes are
So the answer is 8.
How do I code this if I could edit the number of variables? Like the number of boxes or the number of inputs I could do, not just 1 or 0.
Is it close to combination with repetition? I am not sure.
$possibilities = $number_of_variables ** $number_of_boxes
It’s a simple answer that will give you all possible outcomes, which is 2 to the power of 3 (2**3), so 2 (all the possible values you can assign) to the power of 3 (all the items you have to assign those values, the boxes).
So 2**3 = 2*2*2 = 8