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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started