Exemplo n.º 1
0
 /**
  * finds the longest common substring for the two provided strings 
  * @param string $a
  * @param string $b
  * @return string the longest common substring	
  */
 public static function longest_common_substring($a, $b)
 {
     $achars = preg_split('//u', $a, -1, PREG_SPLIT_NO_EMPTY);
     $bchars = preg_split('//u', $b, -1, PREG_SPLIT_NO_EMPTY);
     $arr = StringDiff::longest_common_subarray($achars, $bchars);
     return implode($arr);
 }