Question: Create a PHP program (named search.php) with a search box to receive users query and given the query, your program will return a list of

Create a PHP program (named search.php) with a search box to receive users query and given the query, your program will return a list of documents containing the query. Use get method. Print each document file name (without prefix) as a list item with the class of docitem. Make each item be a link to that document file. Display a snippet under each returned document, showing the surrounding text containing the query. Show the number of results and execution time given the query. After the results are returned, the original query should still be in the search box. Use file function file_get_contents to read the entire document as a string. Use string function strpos to find the occurrence of the query. Use string function substr to extract the snippet (e.g., define the range surrounding the query). Use microtime to measure the execution time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!