Enter your search word "; print "The properties with your search term " . $searchVal . " are:-
";//Output search request detail $fileName="propDetails.txt"; //puts file called propDetails in variable fileName $filePointer = fopen($fileName,"r"); //opens propDetails for read $aFile=file($fileName); //puts file contents of propDetails into array called aFile for($myCount=0; $myCount1) //adjustment to stop duplicate entries appearing due to lowercase change { $aWordChunk = strtolower($aWordChunk);//to accommodate upper and lower case $searchVal = strtolower($searchVal); //to accommodate upper and lower case } if ($aWordChunk==$searchVal) //if a match is found { print $aLine . "
\n"; //print the line break; //go to next iteration of outermost loop (otherwise the same search term may be found later in the same line and create duplicates) }//end of if equals search then print }//end of for loop to work along the word, comparing the search term with each section of the word, measuring length of word and search length } //end of loop to get the length of digits in search, and length of digits in word } //end of file reading outer loop, which reads line by line $searchVal=""; //set $searchVal to "" to avoid incorrect input and therefore incorrect search results function getItem($text, $startNumber, $noOfLetters) //this function reads a certain number of letters, from a start point { return substr($text, $startNumber, $noOfLetters);#substt(text, start_char, number_of_chars) } function getValue($text,$position) //create the two variables to hold the passed values { $intoArray = explode(",",$text);//explode puts the text into array return $intoArray[$position]; //return the word to where the function was called in the code } fclose ($filePointer); //close filePointer ?>