An example analysis of the total number of files and lines of code in PHP statistics directory

Source: Internet
Author: User
The total number of files in the PHP statistics directory and the number of lines of code, perform the statistics of files in the directory

When skipping files: the matching rules only start with the file name, and the matching rules are limited to the beginning.

Skip comment lines in a file: The matching rules are only matched from the header of the comment paragraph, and if the//and * and #及/* and the line beginning with/* and the empty row are skipped. So, like/* This multi-sweat annotation, the beginning of each line must be preceded by an * number, otherwise it cannot match the comment.

Directory filtering: Matching rules are matched from the full name of the directory name

First download the total number of files and lines of code in the PHP statistics directory that we need to use for this lesson: http://www.php.cn/xiazai/leiku/542

After the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!

Once this is done, we will invoke this class in the new PHP file, and instantiate the class:

<?phpinclude_once "wenjian.php";//Introduce class file $obj = new Caculatefiles ();//instantiation//If set to False, this will not display information for each file, otherwise the $obj-> Setshowflag (false);//Skips all file $obj->setfileskip (Array (' all ') at the beginning of all, $obj->run ("D:/PHPSTUDY/WWW/CV");//All Files , (the default format is. php) $obj->setfileskip (Array ()), $obj->run ("D:/PHPSTUDY/WWW/CV"), $obj->setshowflag (TRUE);// Skip all files beginning with I and a, (e.g. interface and abstract class beginning) $obj->setfileskip (Array (' I ', ' a ')), $obj->run ("D:/PHPSTUDY/WWW/CV"); >

The results of the operation are as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.