這是一個用來檢測PHP專案中是否有相同程式碼的工具
要用PEAR安裝
#將pear改成會自動搜尋相關的套件 pear config-set auto_discover 1 pear install pear.phpunit.de/phpcpd
使用方法
phpcpd project/
顯示結果(有兩個檔案5-31行是重複的)
phpcpd 1.4.0 by Sebastian Bergmann. Found 1 exact clones with 26 duplicated lines in 2 files: - /usr/local/www/apache22/data/zend/index.php:5-31 /usr/local/www/apache22/data/zend/public/index.php:5-31 20.80% duplicated lines out of 125 total lines of code. Time: 0 seconds, Memory: 1.50Mb