php check file diff exist and get file diff -
how can check , find differences(e.g svn diff, netbeans diff) between 2 files using php?
platform : win 7 32bit, php 5.4.7 (vc9 x86 32bit thread safe), xampp version 1.8.1
loaded extensions : core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, spl, odbc, pcre, reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, pdo, bz2, simplexml, wddx, xml, xmlreader, xmlwriter, apache2handler, phar, curl, mbstring, exif, gd, gettext, mysql, mysqli, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, xmlrpc, xsl, mhash
this depends on how wish compare files. text files or binary files etc. if assume text files have decide if white spaces should ignored etc. open 2 files compare , go through them character character , compare them. boils down solve longest common sub-sequence problem. recommend start looking @ algorithms comparing found here example
http://en.wikipedia.org/wiki/diff#algorithm
another approach include patch (which can found windows to) , run in background find differences , build patch files (since guess want find differences , able store them , maybe apply them later?)
Comments
Post a Comment