I have two foreach loops: 1st one:
foreach ($items as $key => $item)
{
$keywords = explode(\' \', $qsvarus);
$title[$key]
The obvious solution:
$output1 = array();
$output2 = array();
foreach ($items as $key => $item)
{
$keywords = explode(' ', $qsvarus);
$title[$key] = preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '$0', $title[$key]);
$infoo[$key] = preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '$0', $infoo[$key]);
$output1[] = ''.$title[$key].$infoo[$key].$item.' ';
}
foreach ($linkai as $key => $linkas) {
$i++;
$a1 = $linkas[1];
$a2 = str_replace("download/", "files/", $a1);
$a3 = str_replace("&","&", $a2);
$a4 = str_replace("amp;nbsp;","nbsp;", $a3);
$output2[] = "";
}
$output = array_map( null, $output1, $output2 );
foreach ( $output as $lines ) {
$lines = array_filter( $lines );
foreach ( $lines as $line ) {
echo $line;
}
}