views:

750

answers:

4

How can I measure number of lines of code in my PHP web development projects?

Edit: I'm interested in windows tools only

A: 

If you're using a full fledged IDE the quick and dirty way is to count the number of "\n" patterns using the search feature (assuming it supports regexes)

Allain Lalonde
This was an accepted answer!? WTF? It must have worked.
Allain Lalonde
LOL, it must have, that's why it was accepted :p
Click Upvote
Lines of code is *not* the same as number of lines in the file. Especially for PHP, which often has code interspersed with markup.
Brandon Craig Rhodes
Which is why I was so surprised. :)
Allain Lalonde
+10  A: 

Check CLOC, it's a source code line counter that supports many languages, I always recommend it.

It will differentiate between actual lines of code, blank lines or comments, it's very good.

In addition there are more code counters that you can check:

CMS
All of these are linux tools, do you have any windows ones?
Click Upvote
CMS
I did download it but i got a blank DOS screen and then it disappeared?
Click Upvote
It's a console app!, you have to run it from the command line, i.e. cloc-1.06.exe C:\myProject\folder
CMS
Thanks, i tried it but there's something wrong, it said there were only 3 PHP files in my project? that's impossible. Other than that it seems very useful :)
Click Upvote
Check this one I think it's more friendly :) (and supports PHP code also) http://is.gd/fDF9
CMS
+1  A: 

If you are on a linux box, the easiest way is probably directed by this SO question:

http://stackoverflow.com/questions/114814/count-non-blank-lines-of-code-in-bash

Jeffrey
A: 

The SD Source Code Search Engine is a GUI for searching across large bodies of source code such as a PHP web site. It is fast because it preindexes the source code.

As a side effect of the indexing process, it also computes metrics on the source code base, including SLOC, Comments, blank lines, Cyclomatic and Halsted complexity numbers.

And it runs on Windows.

Ira Baxter