Anyone knows a good implementation of file size as a value object in PHP?
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);
精彩评论