<?php require dirname(dirname(__DIR__)) . '/Rundiz/Number/Number.php'; $filesizes = array(100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000001, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000, 1.0E+19, 130, 1300, 13300, 133300, 1333300, 13333300, 133333300, 1333333300, 13333333300, 133333333300, 1333333333300, 13333333333300); $number = new Rundiz\Number\Number(); echo '<h3>Warning! this test may error on Windows or any 32bit system.</h3>'; echo '<strong>convert from bytes auto unit</strong><br>'; foreach ($filesizes as $size) { echo $size . ' = ' . $number->fromBytes($size) . '<br>'; } echo '<br>'; echo '<strong>convert from bytes KB unit</strong><br>'; foreach ($filesizes as $size) { echo $size . ' = ' . $number->fromBytes($size, 'KB') . '<br>'; } echo '<br>'; echo '<strong>convert from bytes KiB unit</strong><br>'; foreach ($filesizes as $size) { echo $size . ' = ' . $number->fromBytes($size, 'KiB') . '<br>'; } echo '<br>'; echo '<strong>convert from bytes GB unit</strong><br>'; foreach ($filesizes as $size) { echo $size . ' = ' . $number->fromBytes($size, 'GB') . '<br>'; } echo '<br>'; echo '<strong>convert from bytes YB unit</strong><br>'; foreach ($filesizes as $size) { echo $size . ' = ' . $number->fromBytes($size, 'YB') . '<br>'; } echo '<br>';
public function testConvertByte() { $Number = new \Rundiz\Number\Number(); $this->assertEquals('100.00 GB', $Number->fromBytes(100000000000)); $this->assertEquals('8020000000000', $Number->toBytes('8.02TB')); }
?> </li> <?php if (is_array($this->log_sections)) { foreach ($this->log_sections as $section => $data_array) { if (!is_array($data_array)) { break; } if ($section == 'Logs') { $summary = count($data_array); } elseif ($section == 'Time Load') { $summary = $this->getReadableTime(($this->end_time - $this->start_time) * 1000); } elseif ($section == 'Memory Usage') { $summary = $this->max_memory_usage; if (isset($number)) { $summary = $number->fromBytes($summary); } else { $summary = $this->getReadableFileSize($summary); } } elseif ($section == 'Database') { $summary = count($data_array); } elseif ($section == 'Files') { $summary = count($data_array) - 2; } elseif ($section == 'Get' || $section == 'Post' || $section == 'Session') { $summary = count($data_array); } else { $summary = ''; } // li of each section. echo '<li class="rdprofiler-see-details">' . "\n"; // display section tabs.