php code help

  ugy101 12:23 09 Mar 2004

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.

Elsewhere on IDG sites

The Evil Within 2 review-in-progress

InVision Studio takes on Adobe XD and Sketch

iPhone X news: Release date, price, new features & specs

Comment transformer un iPhone en borne Wi-Fi ?