How to calculate the number of lines in source code
You can just use
find . -name '*.php' | xargs wc -l
Use sloccount
"SLOCCount", a set of tools for counting physical Source Lines of Code (SLOC) in a large number of languages of a potentially large set of programs