File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,36 @@ composer require jblond/php-diff
27
27
28
28
## Example Use
29
29
30
+ ``` PHP
31
+ <?php
32
+ // installed via composer
33
+ require 'vendor/autoload.php';
34
+
35
+ // or installed manual
36
+ require dirname(__FILE__).'/../lib/Autoloader.php';
37
+ new \jblond\Autoloader();
38
+
39
+ $a = explode("\n", file_get_contents(dirname(__FILE__).'/a.txt'));
40
+ $b = explode("\n", file_get_contents(dirname(__FILE__).'/b.txt'));
41
+ // Options for generating the diff
42
+ $options = array(
43
+ //'ignoreWhitespace' => true,
44
+ //'ignoreCase' => true,
45
+ );
46
+ // Initialize the diff class
47
+ $diff = new \jblond\Diff($a, $b, $options);
48
+
49
+ //choose renderer
50
+ $renderer = new \jblond\Diff\Renderer\Html\SideBySide(array(
51
+ 'title_a' => 'Custom title for OLD version',
52
+ 'title_b' => 'Custom title for NEW version',
53
+ ));
54
+
55
+ //show it
56
+ echo $diff->Render($renderer);
57
+ ```
58
+
59
+ ### Example Output
30
60
A quick usage example can be found in the example/ directory and under
31
61
example.php.
32
62
You can’t perform that action at this time.
0 commit comments