Tag Archives: php array_diff

Finding Difference Between Two Files with PHP

Today I will show you a short and effective solution to “minus” one file from another. The first solution uses PHP’s array_diff function and is useful when your files are not too big as this method consumes server RAM if you create big arrays. Here is the code: <? $file1=file(“plus.txt”); $file2=file(“minus.txt”); $hopa=array_diff($file1, $file2); ?> $hopa is the array… Read More »