note 94566 modified in function.filesize by danbrown

From: Date: Thu, 12 Nov 2009 13:32:29 +0000
Subject: note 94566 modified in function.filesize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162802@lists.php.net to get a copy of this message
My solution for calculating the directory size: <?php /** * Get the directory size * @param directory $directory * @return integer */ function dirSize($directory) { $size = 0; foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){ $size+=$file->getSize(); } return $size; } ?> --was-- My solution for calculating the directory size: /** * Get the directory size * @param directory $directory * @return integer */ function dirSize($directory) { $size = 0; foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){ $size+=$file->getSize(); } return $size; } http://php.net/manual/en/function.filesize.php

« previous php.notes (#162802) next »