Sometimes you need to find wich line you have changed in a script and you don't have cvs or any tool other than PHP ? So this is a fast way that to find changed line and the content of each one.
<?php
/**
*
* @author Ben Yacoub Hatem <info at phptunisie.net>
* $ version 1.0.0 Sun Oct 24 23:01:22 CEST 2004 23:01:22 by hatem
*/
$file1 = "data1.php.orig";
$file2 = "data1.php";
$data1 = file($file1);
$data2 = file($file2);
foreach ($data1 as $k=>$v) {
if (trim($data2[$k])!=trim($v)) {
echo "line $k => $v | $data2[$k]\n<br>";
}
}
?>