Lately, I’ve been wondering how to find the difference between two files with PHP. Lets say for example I have one text files that says:
"Line one data = test test"
Then one file that says:
"Line one data = test test Line two data = test test"
What I want to do is output the difference between the two files which would be:
"Line two data = test test"
How can I accomplish this with PHP? Any help would be highly appreciated!
Cast the text files to strings then use str_replace()
Or use str_ireplace for case-sensitive replacing.