Does anyone know a good implementation of file size as a value object in PHP?

In the project, I came across a lot of links to disk or file sizes (in bytes, kilograms, mega, etc.), therefore, although this is a very good candidate for a cost object, such as Money or Quantity. Interestingly, has anyone ever done this before in php. Thanks.

+4
source share
1 answer

You can use Zend_Measure_Binary ...

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

Source: https://habr.com/ru/post/1339107/


All Articles