Calculate the size of your PHP program

Source: Internet
Author: User
Copy CodeThe code is as follows:

/**
* Calculate the programmed code, including the file number, the number of rows, the number of characters
*
* @version 1.0
* @since 1.0
* @access Public
* @author Ryan
* @copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @package Aaportal
*/
Please change the location of this catalogue
$dir = "Aaportal";
The following does not have to be
$counts = Array ("directory" = + 0, "file" = 0, "line" = 0, "size" = 0);
Check ($DIR);
echo "total:\n";
echo "Directry:". $counts ["directory"]. " \ n ";
echo "File:". $counts ["File"]. " \ n ";
echo "line:". $counts ["line"]. " \ n ";
echo "Size:". $counts ["Size"]. " \ n ";
function Check ($dir)
{
Global $counts;
if ($dh = Opendir ($dir)) {
while (($file = Readdir ($DH))!== false) {
if ($file = = ".") continue;
if ($file = = ".") continue;
if ($file = = "CVS") continue;
$path = $dir. " /". $file;
if (Is_dir ($path)) {
$counts ["Directory"]++;
echo "dir". $counts ["directory"]. "$path \ n";
Check ($path);
} else {
$ext = Array_pop (Explode ('. ', basename ($path)));
if ($ext = = "php" | | $ext = = "Inc") {
$counts ["File"]++;
echo "File". $counts ["File"]. "$path \ n";
$lines = file ($path);
$counts ["line"] + = count ($lines);
$counts ["size"] + = FileSize ($path);
}
}
}
Closedir ($DH);
}
}?>

The above describes the size of the PHP program you have developed, including aspects of the content, you want to be interested in PHP tutorial friends helpful.

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