php help

  ugy101 13:40 09 Mar 2004
Locked

i have been working on some php coding and i can't seem to search through a .txt folder. i have provided the coding below. I am trying to search through a dictionary of words and try to match it with a word entered. can any one please let me know how to search through a file with more than 1 word in it, as it works fine with just 1 word.
Thanks

?php

$word1 = strtolower($word1); $word1 = eregi_replace ( "[[:space:]]+", " ", $word1 ); $word1 = trim($word1); $word2 = fopen("dictionary.txt", "r");

Search($word1, $word2, $line);


function Search($word1, $word2, $line) {

while (! feof($word2)) {

$line = fgets($word2, 7);

if($word1 == $line) { Matches($word1, $line); }

else { NotMatch($line, $word2, $line); } }

}

function Matches($word1, $line) { print"$word1 matches $line"; }

function NotMatch($word1, $word2, $line) {

print"$word1 does not match $line";

}

?>

  Taran 15:15 09 Mar 2004

Before we get cracking on this, are you using MySQL in this project ?

If so, wouldn't you be far better off using the built in full text search capabilities of MySQL ?

  ugy101 10:56 11 Mar 2004

no i am not using mysql

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

AMD Radeon Adrenalin release date, new features, compatible graphics cards

Inside the iMac Pro - Apple's most powerful Mac yet

iMac Pro release date, UK price & specs

Comment nettoyer Windows et optimiser son PC gratuitement ?