public function getDirSize($dir, $format = true)
{
$dir_iterator = new RecursiveDirectoryIterator($dir);
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
$size = 0;
foreach ($iterator as $file) {
$size += $file->getSize();
}
if ($format) {
if ($size / 1048576 > 1) {
return round($size / 1048576, 1) . ' MB';
// if the total size is bigger than 1 KB
} elseif ($size / 1024 > 1) {
return round($size / 1024, 1) . ' KB';
// else return the filesize in bytes
} else {
return round($size, 1) . ' bytes';
}
} else {
// return the total filesize in bytes
return $size;
}
}
usage:
$size = getDirSize('/dir/to/get/size/');
Hostingo Nuolaidos
50% nuolaida serveriai.lt (svetainių talpinimui)
50% nuolaida dedikuoti.lt (dedikuotų serverių nuomai)
50% nuolaida hostingas.lt (hostingui)
20% nuolaida internetinių adresų registravimui
Serveriai.lt svetainės talpinimo 50% nuolaida
Phalcon upgrade to 1.3.1 errors after upgrade from 1.2.6
I had plenty of errors after upgrade and the solution to all of them at once is simple - re-install php. Uninstall php/apache/nginx/sql/phpmyadmin - what you have and then install all one after one. start with apache, php, sql then phalcon :)
How To download Facebook Look Back video?
1. Open Google Chrome browser and go to https://www.facebook.com/lookback
2. Click F12 button on you keyboard or use your mouse: right-click anywhere outside the movie and select "Inspect Element" (it should be last option on the menu)
2. Click F12 button on you keyboard or use your mouse: right-click anywhere outside the movie and select "Inspect Element" (it should be last option on the menu)
function get_currency_rate
Simple, yet effective way to get currency rate from yahoo finance service. Cache the results, or you will get ban from yahoo.
Subscribe to:
Posts (Atom)