If you are attempting to find a count of the total lines of code in files in a directory recursively from Linux or Mac OS X the following command will do what you want. This particular command prints out all lines contained in any file with a .php extension, then counts the number of lines printed.
( find . -name '*.php' -print0 | xargs -0 cat ) | wc -l
This version allows the usage of regular expressions, which may be more flexible than the “find” command global expressions.
(find . | grep -E “\\.cc|\\.c|\\.h” | tr ‘\n’ ‘\0’ | xargs -0 cat) | wc -l
There’s also some apps in the App Store for this such as SourceCounter and Xloc.