php help

  ugy101 13:40 09 Mar 04

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.


$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 04

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 04

no i am not using mysql

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

How to watch Surface PC live stream | Surface PC release date, price, spec rumours: All-in-one…

1995-2015: How technology has changed the world in 20 years

Best Photoshop video tutorials: 8 video tutorial websites for Photoshop

Apple's event invitations decoded: A look back at 16 of Apple's most cryptic invites | Clues in…