protected function printDiff($stringA, $stringB)
{
if ($stringA === $stringB) {
return 0;
// that's what diff would return
}
$fileA = tempnam(sys_get_temp_dir(), 'sfn_a_');
file_put_contents($fileA, $stringA);
$fileB = tempnam(sys_get_temp_dir(), 'sfn_b_');
file_put_contents($fileB, $stringB);
$command = is_file('/usr/bin/colordiff') ? 'colordiff' : 'diff';
$command .= " -u {$fileA} {$fileB}";
passthru($command, $returnVar);
unlink($fileA);
unlink($fileB);
return $returnVar;
}