wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_convert_hr_to_bytes › WordPress Function
Seit2.3.0
Veraltetn/v
› wp_convert_hr_to_bytes ( $value )
| Parameter: |
|
| Links: | |
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: | |
| Changelog: |
|
Converts a shorthand byte value to an integer byte value.
Ähnliche Funktionen: wp_convert_bytes_to_hr, convert_chars, convert_to_screen, rest_convert_error_to_response, wp_count_terms
Quellcode
function wp_convert_hr_to_bytes( $value ) {
$value = strtolower( trim( $value ) );
$bytes = (int) $value;
if ( str_contains( $value, 'g' ) ) {
$bytes *= GB_IN_BYTES;
} elseif ( str_contains( $value, 'm' ) ) {
$bytes *= MB_IN_BYTES;
} elseif ( str_contains( $value, 'k' ) ) {
$bytes *= KB_IN_BYTES;
}
// Deal with large (float) values which run into the maximum integer size.
return min( $bytes, PHP_INT_MAX );
}