There are 3 arrays:
$name = array('foo','bar'); $os = array('win','linux'); $arch = array('x86','x64'); How many different combinations (arrays) can I get?
We count: $ name (2 pieces) * $ os (2 pieces) * $ arch (2 pieces) = 8 options
We look at the tree:

In the final version you need to get:
$graph = array( array('foo', 'win', 'x86'), array('foo', 'win', 'x64'), array('foo', 'linux', 'x86'), array('foo', 'linux', 'x64'), array('bar', 'win', 'x86'), array('bar', 'win', 'x64'), array('bar', 'linux', 'x86'), array('bar', 'linux', 'x64') ); How can such an array be implemented in PHP?