80 $m_end =
count($X) - 1;
84 $n_end =
count($Y) - 1;
96 for (
$i = $m_start;
$i <= $m_end;
$i++)
99 for ($j = $n_start; $j <= $n_end; $j++)
102 if ($X[
$i] == $Y[$j])
105 $C[
$i][$j] = $C[
$i - 1][$j - 1] + 1;
110 $k = max($C[
$i][$j - 1], $C[
$i - 1][$j]);
116 if ($C[
$i][$j - 1] <
$k)
118 for ($jj = $j - 1;$jj >= $n_start;$jj--)
120 if (is_array($C[
$i]) && array_key_exists($jj, $C[
$i]))
137 if (is_array($C[$ii]))
139 for ($j = $n_end; $j > $n_start && array_key_exists($j, $C[$ii]); $j--)
141 if ($C[
$i][$j] > $C[$ii][$j])
193 preg_match_all(
'/(<.*?>\s*|\s+)([^\s<]*)/',
' ' . $X, $Xmatch);
194 preg_match_all(
'/(<.*?>\s*|\s+)([^\s<]*)/',
' ' . $Y, $Ymatch);
198 while (
count($Xmatch[0]) &&
count($Ymatch[0]) && (trim($Xmatch[2][0]) == trim($Ymatch[2][0])) )
200 $sHTMLStart .= $Xmatch[0][0];
201 array_shift($Xmatch[0]);array_shift($Xmatch[1]);array_shift($Xmatch[2]);
202 array_shift($Ymatch[0]);array_shift($Ymatch[1]);array_shift($Ymatch[2]);
206 $X_end =
count($Xmatch[0]) - 1;
207 $Y_end =
count($Ymatch[0]) - 1;
209 while ( ($X_end >= 0) && ($Y_end >= 0) && (trim($Xmatch[2][$X_end]) == trim($Ymatch[2][$Y_end])) )
211 $sHTMLEnd = $Xmatch[0][$X_end] . $sHTMLEnd;
212 unset($Xmatch[0][$X_end]);unset($Xmatch[1][$X_end]);unset($Xmatch[2][$X_end]);
213 unset($Ymatch[0][$Y_end]);unset($Ymatch[1][$Y_end]);unset($Ymatch[2][$Y_end]);
219 $Xmatch_trimmed = [];
220 foreach ($Xmatch[2] as
$i => $match)
222 $Xmatch_trimmed[] = trim($match);
225 $Ymatch_trimmed = [];
226 foreach ($Ymatch[2] as
$i => $match)
228 $Ymatch_trimmed[] = trim($match);
238 count($Xmatch_trimmed) - 1,
239 count($Ymatch_trimmed) - 1,
241 $sHTML = ob_get_contents();
244 $sHTML = preg_replace(
'#</b >(\s*)<b style="color:green">#',
'\\1', $sHTML);
245 $sHTML = preg_replace(
'#<b style="color:green">(\s*)</b >#',
'\\1', $sHTML);
246 $sHTML = preg_replace(
'#</s >(\s*)<s style="color:red">#',
'\\1', $sHTML);
247 $sHTML = preg_replace(
'#<s style="color:red">(\s*)</s >#',
'\\1', $sHTML);
249 return $sHTMLStart . $sHTML . $sHTMLEnd;
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)