mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-07-31 02:10:37 +02:00
Gelato: Number Class new method convertToBytes() added.
This commit is contained in:
@@ -58,14 +58,14 @@ class Number
|
||||
* @return int
|
||||
*/
|
||||
public static function convertToBytes( $num ) {
|
||||
$size = strtolower( $size );
|
||||
$bytes = (int) $size;
|
||||
if ( strpos( $size, 'k' ) !== false )
|
||||
$bytes = intval( $size ) * 1024;
|
||||
elseif ( strpos( $size, 'm' ) !== false )
|
||||
$bytes = intval($size) * 1024 * 1024;
|
||||
elseif ( strpos( $size, 'g' ) !== false )
|
||||
$bytes = intval( $size ) * 1024 * 1024 * 1024;
|
||||
$num = strtolower( $num );
|
||||
$bytes = (int) $num;
|
||||
if ( strpos( $num, 'k' ) !== false )
|
||||
$bytes = intval( $num ) * 1024;
|
||||
elseif ( strpos( $num, 'm' ) !== false )
|
||||
$bytes = intval($num) * 1024 * 1024;
|
||||
elseif ( strpos( $num, 'g' ) !== false )
|
||||
$bytes = intval( $num ) * 1024 * 1024 * 1024;
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user