atrsimilar_diff_merge

Versions
6.1
atrsimilar_diff_merge($tokens)

▾ 1 function calls atrsimilar_diff_merge()

atrsimilar_diff in atr/modules/atrsimilar/includes/atrsimilar.review.inc
Compute the differences between two strings.

Code

atr/modules/atrsimilar/includes/atrsimilar.review.inc, line 231

<?php
function atrsimilar_diff_merge($tokens) {
  $diff = array();
  $i = -1;
  foreach ($tokens as $token) {
    if (isset($diff[$i]) && $diff[$i]['common'] == $token['common']) {
      $diff[$i]['string'] .= $token['string'];
    }
    else {
      $i++;
      $diff[$i] = $token;
    }
  }

  return $diff;
}
?>