Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP File/Load Size

Status
Not open for further replies.

booeyOH

Programmer
May 30, 2007
48
US
Is there a way , at the bottom of a script, to show how much, in size, was loaded for the script. For example, it is a 300kb php file that includes 2 600 kb files, so it loaded 1.5mb?

Not even sure if I am thinking about this right, just want to un-bloat my scripts :)

Thanks.
 
the size of each php file is not directly relevant to the amount of memory consumed.

memory_get_peak_usage() will report on the actual memory used by php.

if you really just want the file sizes then something like this at the end of your script might work

Code:
function getFileSizes(){
 $size = filesize(__FILE__); //current file
 $iFiles = get_included_files();
 foreach ($iFiles as $iFile){
    $size = ($size + filesize($iFile));
 }
 return $size;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top