Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$arr = array(
'Color' => array('Red', 'Blue'),
'Size' => array('Regular', 'Large'),
'Material' => array('Metalic', 'Nylon')
function magic_algorithm($arr){
$result = magic_algorithm($arr);
$expected = array(
"Color: Red; Size: Regular; Material: Metalic",
"Color: Red; Size: Regular; Material: Nylon",
"Color: Red; Size: Large; Material: Metalic",
"Color: Red; Size: Large; Material: Nylon",
"Color: Blue; Size: Regular; Material: Metalic",
"Color: Blue; Size: Regular; Material: Nylon",
"Color: Blue; Size: Large; Material: Metalic",
"Color: Blue; Size: Large; Material: Nylon"
echo ($expected == $result) ? "Passed" : "Failed";
echo "\n";

This comment has been minimized.

Copy link

@mocheng mocheng commented Feb 17, 2011

Looks a cartesian product quiz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment