Home » Php » php – How to measure # of lines of code in project?

php – How to measure # of lines of code in project?

Posted by: admin July 12, 2020 Leave a comment

Questions:

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

Edit: I’m interested in windows tools only

How to&Answers:

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)

Answer:

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:

Answer:

phploc

No experience if it runs on Windows, tho, but searching on the web showed some results of people getting it to work on Windows..

Answer:

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

count (non-blank) lines-of-code in bash

Answer:

Our 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.