Can I use file_get_contents() to compare two files?

后端 未结 7 1682
无人及你
无人及你 2020-12-03 03:09

I want to synchronize two directories. And I use

file_get_contents($source) === file_get_contents($dest)

to compare two files. Is there an

7条回答
  •  [愿得一人]
    2020-12-03 03:51

    Seems a bit heavy. This will load both files completely as strings and then compare.

    I think you might be better off opening both files manually and ticking through them, perhaps just doing a filesize check first.

提交回复
热议问题