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