Compare two results and show difference like in PHPUnit

Code
<?php

use SebastianBergmann\Diff\Differ;

$differ = new Differ();

$val1 "1\n2\n3\n4";
$val2 "3\n2\n4\n1";

echo 
$differ->diff($val1$val2);

$val1 = [1,2,3,4];
$val2 = [4,3,2,1];

echo 
$differ->diff($val1$val2);
Result
--- Original
+++ New
@@ @@
-1
+3
2
-3
4
+1
--- Original
+++ New
@@ @@
+4
+3
+2
1
-2
-3
-4
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6