开发者

Anyone knows a good implementation of file size as a value object in PHP?

开发者 https://www.devze.com 2023-02-09 08:49 出处:网络
In project i came across a lot of references to disk or file sizes(in bytes, kilo, mega etc) so i though this is a very g开发者_JAVA百科ood candidate for a value object like Money or Quantity. I wonde

In project i came across a lot of references to disk or file sizes(in bytes, kilo, mega etc) so i though this is a very g开发者_JAVA百科ood candidate for a value object like Money or Quantity. I wonder if anyone has ever done this before in php. Thanks.


You can use Zend_Measure_Binary...

$measure = new Zend_Measure_Binary($size, Zend_Measure_Binary::BYTE);
$size = $measure->convertTo(Zend_Measure_Binary::MEGABYTE);
0

精彩评论

暂无评论...
验证码 换一张
取 消