Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataSize.php
Go to the documentation of this file.
1 <?php
8 
12 class DataSize
13 {
21  public function convertSizeToBytes($size)
22  {
23  if (!is_numeric($size)) {
24  $type = strtoupper(substr($size, -1));
25  $size = (int)$size;
26 
27  switch ($type) {
28  case 'K':
29  $size *= 1024;
30  break;
31 
32  case 'M':
33  $size *= 1024 * 1024;
34  break;
35 
36  case 'G':
37  $size *= 1024 * 1024 * 1024;
38  break;
39 
40  default:
41  break;
42  }
43  }
44  return (int)$size;
45  }
46 }
$type
Definition: item.phtml:13