In our DB we have one table that is the result of every permutation from three tables.
I'm trying to write a PHP script that will look at all of these tables as arrays and detect whether there is a missing permutation.
e.g.
$foo = array('one', 'two', NULL)
$bar = array('three', 'four', NULL)
$baz = array('five', 'six', NULL)
$permutations = array(
array('one', 'three', 'five'),
array('two', 'three', 'five'),
array(NULL, 'three', 'five'),
//etc
)
foreach $foo as $x
foreach $bar as $y
foreach $baz as $z
$combo = array($x, $y, $z)
if $combo is not in $permutations
//generate sql to update db
How can I achieve this?
$permutationslength is the same as X^Y (or whatever the range of sets should be)...you can also do something like making sure that $permutations has only unique elements before doing the length check. This may be more efficient than having to check every single possible permutation.