Someone posed an interesting probelm over at sitepoint the other day.
Given an array of words how can you work out each possible combination?
There are a few methods but here's the PHP code for the cleanest:
$words = array('red', 'blue', 'green');
$num = count($words);
//The total number of possible combinations
$total = pow(2, $num);
//Loop through …