lib/blobfolio/common/data.php
public static function length_in_range(string $str, $min=null, $max=null) {
		if ((null !== $min) && ! \is_int($min)) {
			ref\cast::int($min, true);
		}
		if ((null !== $max) && ! \is_int($max)) {
			ref\cast::int($max, true);
		}

		$length = mb::strlen($str);
		if ((null !== $min) && (null !== $max) && $min > $max) {
			static::switcheroo($min, $max);
		}

		if ((null !== $min) && $min > $length) {
			return false;
		}

		if ((null !== $max) && $max < $length) {
			return false;
		}

		return true;
	}
public static function length_in_range(string $str, $min=null, $max=null) {
		if ((null !== $min) && ! \is_int($min)) {
			ref\cast::int($min, true);
		}
		if ((null !== $max) && ! \is_int($max)) {
			ref\cast::int($max, true);
		}

		$length = mb::strlen($str);
		if ((null !== $min) && (null !== $max) && $min > $max) {
			static::switcheroo($min, $max);
		}

		if ((null !== $min) && $min > $length) {
			return false;
		}

		if ((null !== $max) && $max < $length) {
			return false;
		}

		return true;
	}
public static function length_in_range ( string $ str , $ min = null , $ max = null ) { if ( ( null !== $ min ) && ! \ is_int ( $ min ) ) { ref \ cast :: int ( $ min , true ) ; } if ( ( null !== $ max ) && ! \ is_int ( $ max ) ) { ref \ cast :: int ( $ max , true ) ; } $ length = mb :: strlen ( $ str ) ; if ( ( null !== $ min ) && ( null !== $ max ) && $ min > $ max ) { static :: switcheroo ( $ min , $ max ) ; } if ( ( null !== $ min ) && $ min > $ length ) { return false ; } if ( ( null !== $ max ) && $ max < $ length ) { return false ; } return true ; }
Length in Range

See if the length of a string is between two extremes.

@param string $str String.
@param int $min Min length.
@param int $max Max length.
@return bool True/false.
Length in Range