Over on my other site I just posted a blog entry about a Dominos pizza ad campaign where each day they release a word puzzle and if you solve the puzzle you get a link to an eBay auction where the first ten people that day (for only $9.99) can buy pretty cool stuff, like an iPod or a year’s worth of pizza.

The puzzles are one of three forms: Word Jumbles, CryptoQuips or Domino’s Trivia. The Word Jumble is just as it sounds; they scramble the letters of some Domino’s themed sentence around and you get to unscramble it. For example: MOIODSN HITNNYGA SOGE ALED

Here’s the link to my Word Jumble solver Domino’s Pizza Anything Goes Deal Helper Script

And here is the code:

if (isset($_REQUEST["word_jumble"])&&$_REQUEST["word_jumble"]!=‘’)
{
 
$vocabArray=array(‘2-liter’,‘a’,…,‘Vine-Ripened’,‘wings’);
 
$lookuptable=array();
foreach($vocabArray as $vocab)
{
  $str=strtoupper($vocab);
  $tempArray= array();
  for($i=0; $<strlen($str); $i++)
    {
      $tempArray[]=$str[$i];
    }
  sort($tempArray);
  $tempStr=implode(‘’,$tempArray);
  $lookuptable[$tempStr]=$vocab;
}
$wordArray=explode(‘ ‘,$word_jumble);
foreach ($wordArray as $word)
{
  $str=strtoupper($word);
  $tempArray= array();
  for($i=0; $<strlen($str); $i++)
    {
      $tempArray[]=$str[$i];
    }
  sort($tempArray);
  $tempStr=implode(‘’,$tempArray);
  $unscrambled = ($lookuptable[$tempStr]==‘’)?‘?????’:$lookuptable[$tempStr];
  echo($word." = ".$unscrambled."n ");
}