How to count lines of code in PHP files in a web application
BY webmaster
6 years ago
0 comments comment

Lines of code is typically indicative of effort that goes towards software development. So how do you count lines of code in your PHP application (or for that matter any specific types of files in any application). You can't manually open and count files, that would be a big waste of time. The *nix shell has a powerful set of tools that can help you count lines without having to do it manually.

find . -name "*.php" | xargs wc -l | awk '{print $1}' | awk '{total = total + $1}END{print total}'

The find command finds files named *.php (you can replace this with other patterns or sets of patterns with -o and -a). These files are passed to wc using xargs. wc prints out the list of files with the number of lines in each. The tabular output is then processed using awk to separate out just the column of line counts. This is then again processed using a bit of awk scripting.

I hope you got the general idea here on how these commands work to give you the number of lines of code in your PHP files. Happy coding.



on 01st April 2007 / by webmaster
The project aims to open up the freelancing market for the Student Community and thereby give tre News Application Development Freelancing Leave a reply Your email address will not be published. Required fields are marked * Anonymous (not verified) access_time 27 May 2020 - 05:21 How can i join this project? what will be rewards and benefits? I am an MBA + BE webmaster access_time 27 May 2020 - 05:21 In reply to To know more by Anonymous (not verified) One of the main objectives of the project was to bring to the engineering students an opportunity to earn while they learn at school. In what capacity are you looking forward to joining the project? Cheers Anoop John Team Zyxware Add new comment

on 17th October 2007 / by webmaster
The release of the health monitoring system was well received by the media. It was covered in almost all the regional newspapers including Malayala Manorama, Mathrubhoomi, Deshabhimani, and some of the regional television channels like DD1 Malayalam, JaiHind, Kairali People, Manorama TV, Amruta TV. It was also taken well by the online media including Hindu, PTI etc. Although we didn't get hold of all the copies of the press releases published in the media we have collected some of the published content and are sharing it here. News Leave a reply Your email address will not be published. Required fields are marked * jeims wadson (not verified) access_time 27 May 2020 - 05:21 Very useful website, wants to see much more on it! Go on! Add new comment
Leave a reply
Your email address will not be published. Required fields are marked *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.