lewis987 Posted July 15, 2007 Share Posted July 15, 2007 basically to functions to get the free size left on the hard-drive and another to get the total space on it. code below. $dir = $server1['data']; $size = disk_total_space($dir); function formatTotal($size){ switch (true){ case ($size > 1048576): $size /= 1048576; $suffix = 'MB'; break; case ($size > 1024): $size /= 1024; $suffix = 'KB'; break; default: $suffix = 'B'; } return round($size, 2).$suffix; } $goose = disk_free_space($dir); function zz($goose){ switch (true){ case ($size > 1048576): $size /= 1048576; $suffix = 'MB'; break; case ($size > 1024): $size /= 1024; $suffix = 'KB'; break; default: $suffix = 'B'; } return round($size, 2).$suffix; } if i echo $goose it shows the space in bytes but i want it to show it in MB or KB depending on the size. Im on PHP 4.4.9 (i believe). Basically its when i cann formatTotal it shows the total space (that one works fine) but when i call "zz" it just shows me "0B" and when i show $goose i get the proper size in bytes. Link to comment https://forums.phpfreaks.com/topic/60058-solved-two-functions-not-working-at-the-same-time/ Share on other sites More sharing options...
lewis987 Posted July 15, 2007 Author Share Posted July 15, 2007 found my error! Link to comment https://forums.phpfreaks.com/topic/60058-solved-two-functions-not-working-at-the-same-time/#findComment-298719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.