I ran across this truth table generator site, and tried to mimic it in PHP (i realize the source code is available, but i know 0 perl).
Now my question is not about evaluating the expression, but how to output the table so that every combination of T and F for the variables is shown
For example, with 3 variables, the table would look like such:
a | b | c
-----------
T | T | T
T | T | F
T | F | T
T | F | F
F | T | T
F | T | F
F | F | T
F | F | F
and with 4 variables..
a | b | c | d
-------------
T | T | T | T
T | T | T | F
T | T | F | T
T | T | F | F
T | F | T | T
T | F | T | F
T | F | F | T
T | F | F | F
F | T | T | T
F | T | T | F
F | T | F | T
F | T | F | F
F | F | T | T
F | F | T | F
F | F | F | T
F | F | F | F
What is the logic/pattern to create it?