Problem in this part when you type @
in the input box
foreach ($result_array as $result) {
// Make Sure you have @ in your $result['firstName']
$display_function = preg_replace(
"/".$search_string."/i",
"<b class='highlight'>".$search_string."</b>",
$result['firstName']);
// Make Sure you have @ in your $result['lastName']
$display_name = preg_replace(
"/".$search_string."/i",
"<b class='highlight'>".$search_string."</b>",
$result['lastName']);
// Insert Name
$output = str_replace('nameString', $display_name, $html);
// Insert Function
$output = str_replace('functionString', $display_function, $output);
// Insert URL
//$output = str_replace('urlString', $display_url, $output);
// Output
echo($output);
}
preg_replace() returns an array if the subject parameter is an array, or a string otherwise.
Take a look on preg_replace() function
If matches are found, the new subject will be returned, otherwise subject
will be returned unchanged or NULL if an error occurred.