Skip to main content

Posts

Showing posts from February, 2020

Get Text difference between new and old

Sample output: THis are my car. This is  my car. function htmlDiff($old, $new){         $diff = self::diffArray(explode(' ', $old), explode(' ', $new));         $flag = 0;         $ret = "";         foreach($diff as $i => $k){             if(is_array($k)){                 if((count($k['d']) != 0) && (count($k['i']) == 0)){                     $flag = 1;                 }                 else if((count($k['d']) != 0) && (count($k['i']) != 0)){                     $ret .= (!empty($k['i'])?"<span style='background-color:#ccffcc'>".implode(' ',$k['i'])."</span> ":'');               ...