View Single Post
Old 12-14-2012, 01:04 AM  
Webmaster Advertising
So Fucking Banned
 
Join Date: Sep 2003
Posts: 1,360
So ive edited some of the code (new code is in red) but its now throwing out a different error

http://www.pixelsquaredesigns.com/words/

Code:
<?php

// Text file containing words 
$txt = '/home/orange/public_html/pixelsquaredesigns.com/words/list.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)) { 
   function strip_newlines($str) {
 // common newline sequences - \r (carriage return), \n (newline or linefeed), and \r\n (carriage return-linefeed)
 $newlines = array(0 => '\r', 1 => '\n', 2 => '\r\n');
 // loop over the newline sequences, replacing them with nothing in the string
 foreach ($newlines as $nl) {
 $str = str_replace($nl, '', $str);
 }
 // return the cleaned string
 return $str;
 }

// 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>";

?>
What did I screw up? LOL

Sorry I'm definitely not fluent in .php but I'm learning slowly... Or trying to lol
Webmaster Advertising is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote