Home  >  Article  >  Backend Development  >  Calculate the size of the PHP program you develop

Calculate the size of the PHP program you develop

WBOY
WBOYOriginal
2016-07-29 08:35:34951browse

Copy the code The code is as follows:

/**
* Calculate the size of the program in the directory, including the number of files, lines, and words
*
* @version 1.0
* @since 1.0
* @access public
* @author Ryan
* @copyright Copyright (c) 2002-2004 by Shiner Technologies Co., Ltd.
* @package AAPortal
*/
// Please modify the location of this directory
$dir = "aaportal";
// No changes are required below
$ 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 { continue ;
                                                                                                                                                                       $counts["directory"]++;
//echo "dir ".$counts["directory"]." $pathn";
                                                                                                                                                           explode('.', basename($path)) ; .$counts["file"]. " $pathn";
                                                               "size"] += filesize($path);
}
                                                                                                                                                                        
The above has introduced how to calculate the size of the PHP program you develop, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn