if (isset($result_array)) {
foreach ($result_array as $result) {
// Format Output Strings And Hightlight Matches
$display_function = preg_replace("/".$search_string."/i", "<b class='highlight'>".$search_string."</b>", $result['email']);
$display_name = preg_replace("/".$search_string."/i", "<b class='highlight'>".$search_string."</b>", $result['email']);
//$display_url = 'http://php.net/manual-lookup.php?pattern='.urlencode($result['function']).'&lang=en';
// 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);
}
when i search if input is match with the email in the datase, I ONLY want to check everything before @ in the email address ignore everything after @. how am i able to do that?
i try to put
$result = array_shift(explode('@', $result['email']));
before display_function. it will remove everything after @ in the result. but it still display the wrong result. which the input string matching email part after @
Use this code: