public static function compare($html1, $html2) { $diff = new HtmlDiff($html1, $html2); $diff->build(); return $diff->getDifference(); }
<div style="font-weight:bold;float:left;margin-right: 25px;">Legend:</div> <div style="color:red;background:#fdd;float:left;margin-right:25px;">▪ - Deleted Text Differences</div> <div style="color:green;background:#dfd;float:left;">▪ - Added Text Differences</div> </div> <div class="row"> <div class="col-sm-7" style="padding-right:0px"> <div class="panel panel-default"> <div class="panel-heading">Compared Document</div> <div class="panel-body" style="height:100%;overflow:auto"> <?php echo $diff->getDifference(); ?> </div> </div> </div> <div class="col-sm-5" style="padding-left:0px;"> <div style="height:50%;padding-bottom: 32px;"> <div class="panel panel-default"> <div class="panel-heading">Original Document - <small>Version <?php echo $original; ?> </small></div> <div class="panel-body" style="height:100%;overflow:auto;margin-bottom:20px"> <?php echo $diff->getOldHtml(); ?>