What is the most elegant and efficient way of comparing a string against text file in PHP.
The flow:
I have a file on server var\user\rinchik\file\fileName\version0.txt.
user comes on the web-site, does his thing and gets $string with N characters length.
I need to check is this string is identical to the contents of var\user\rinchik\file\fileName\version0.txt. If it is then do nothing. If its not then save this string here: var\user\rinchik\file\fileName\version1.txt.
Should i just read the file version0.txt into another string then hash both of them and compare hashes?
Or there is some hidden magic method like: save new string as version1.txt and the run something like file_compare('version0.txt', 'version1.txt'); and it will do the trick?