1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

Gelato: Number Class new method convertToBytes() added.

This commit is contained in:
Awilum
2014-01-29 20:55:17 +02:00
parent 551ce3be6b
commit e74111fb7d

View File

@@ -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;
}