File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,31 @@ echo 'Changed lines: ';
45
45
echo implode(', ', $diff->getChangedLines());
46
46
```
47
47
48
+ Display the Diff in HTML
49
+ ------------------------
50
+
51
+ Very often we need to display the differences directly in the browser, for this the native method ` renderDiff() ` is suitable.
52
+
53
+ ``` php
54
+ $left = 'First text';
55
+ $right = 'Second text';
56
+
57
+ $simpleDiff = new \Baraja\DiffGenerator\SimpleDiff;
58
+ $diff = $
59
+ 
60
+ 
61
+ 
62
+ 
63
+ 
64
+ 
65
+ 
66
+ simpleDiff->compare($left, $right);
67
+
68
+ echo $simpleDiff->renderDiff($diff);
69
+ ```
70
+
71
+ The method accepts Diff and returns valid treated HTML that can be displayed directly to the user.
72
+
48
73
Comparison mode
49
74
---------------
50
75
You can’t perform that action at this time.
0 commit comments