Automator_System_Report::automator_string_to_num( string $size )

Notation to numbers.


Description Description

This function transforms the php.ini notation for numbers (like ‘2M’) to an integer.


Top ↑

Parameters Parameters

$size

(string) (Required) Size value.


Top ↑

Return Return

(int)


Source Source

File: src/core/lib/utilities/class-automator-system-report.php

	public function automator_string_to_num( $size ) {
		$l   = substr( $size, - 1 );
		$ret = (int) substr( $size, 0, - 1 );
		switch ( strtoupper( $l ) ) {
			case 'P':
				$ret *= 1024;
			case 'T':
				$ret *= 1024;
			case 'G':
				$ret *= 1024;
			case 'M':
				$ret *= 1024;
			case 'K':
				$ret *= 1024;
		}

		return $ret;
	}