Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created February 16, 2011 21:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryanflorence/830201 to your computer and use it in GitHub Desktop.
Save ryanflorence/830201 to your computer and use it in GitHub Desktop.
<?php
$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";
print_r($result);
echo "\n";
@mocheng
Copy link

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