Compare two results and show difference like in PHPUnit

Code
<?php

use SebastianBergmann\Diff\Differ;

$differ = new Differ();

$val1 "1\n2\n3\n4";
$val2 "1\n2\n5\n4";

echo 
$differ->diff($val1$val2);
Result
--- Original
+++ New
@@ @@
1
2
-3
+5
4
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8