php code help

  ugy101 12:23 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("/spare/apache/htdocs/stud/c0258873/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);

NotMatch($line, $word2, $line);


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

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

print"$word1 does not match $line";



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

Nintendo Switch review: Hands on with the intuitive modular console and its disappointing games…

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

Here's what should be coming to Adobe Project Felix in 2017

Apple AirPods review: Apple's beautiful new Bluetooth headphones bring true intelligence to…