This is what I was told:

Instead of:
Code:
print_r($words);
print_r($cwords);
use:
Code:
foreach ($words as $var) echo $var."<br>";
foreach ($cwords as $var2) echo $var2."<br>";
So I am guess:
Code:
// Text file containing words 
$txt = '/path/to/wordfile.txt'; 

$handle = fopen($txt, 'r'); 

if (!$handle) { 
   die('Could not open...'); 
} 

// set up arrays for storing words and concatenated words 
$words = array(); 
$cwords = array(); 

// get the words 
while (!feof($handle)) { 
   // strip_newlines is not a real function - needs to be implemented 
   array_push($words, strip_newlines(fgets($handle))); 
} 

// while we still have words 
for ($i = 0; $i < count($words); $i++) { 
   // get the current word 
   $curword = $words[$i]; 
   // loop over the words 
   foreach ($words as $word) { 
      // if the word is the same as the current word, skip it - i.e. no CatCat 
      if ($word == $curword) { 
         continue; 
      } 
      // append the concatenated word to the array 
      array_push($cwords, $curword.$word); 
    } 
} 

foreach ($words as $var) echo $var."<br>";
foreach ($cwords as $var2) echo $var2."<br>";