diff --git a/finediff.php b/finediff.php index 2e38b77..991ed72 100644 --- a/finediff.php +++ b/finediff.php @@ -220,6 +220,15 @@ public function __construct($from_text = '', $to_text = '', $granularityStack = $this->doDiff($from_text, $to_text); } + /** + * Magic __toString() method + * ... + * Assuming `$diff = new FineDiff($from, $to);`, `echo $diff` will print the HTML diff. + */ + public function __toString(){ + return $this->renderDiffToHTML(); + } + public function getOps() { return $this->edits; }