public function int($value, $min = false, $max = false, $default = false)
	{
		$options = array("options" => array());
		if (isset($default)) {
			$options["options"]["default"] = $default;
		}
		if (is_numeric($min)) {
			$options["options"]["min_range"] = $min;
		}
		if (is_numeric($max)) {
			$options["options"]["max_range"] = $max;
		}

		// We really DO NOT need to validate user inputs like 010 or 0x10
		// so this is not needed: $options["flags"] = FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX;
		// If in the code we use something like $this->int(010) this is the
		// same as $this->int(8) - so it will pass and return 8
		// But if we read it from user input, a file etc, it should fail by
		// default. Example Right padding some currencies like 0010.00 USD
		return filter_var($value, FILTER_VALIDATE_INT, $options);
	}
public function int($value, $min = false, $max = false, $default = false)
	{
		$options = array("options" => array());
		if (isset($default)) {
			$options["options"]["default"] = $default;
		}
		if (is_numeric($min)) {
			$options["options"]["min_range"] = $min;
		}
		if (is_numeric($max)) {
			$options["options"]["max_range"] = $max;
		}

		// We really DO NOT need to validate user inputs like 010 or 0x10
		// so this is not needed: $options["flags"] = FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX;
		// If in the code we use something like $this->int(010) this is the
		// same as $this->int(8) - so it will pass and return 8
		// But if we read it from user input, a file etc, it should fail by
		// default. Example Right padding some currencies like 0010.00 USD
		return filter_var($value, FILTER_VALIDATE_INT, $options);
	}
public function int ( $ value , $ min = false , $ max = false , $ default = false ) { $ options = array ( "options" => array ( ) ) ; if ( isset ( $ default ) ) { $ options [ "options" ] [ "default" ] = $ default ; } if ( is_numeric ( $ min ) ) { $ options [ "options" ] [ "min_range" ] = $ min ; } if ( is_numeric ( $ max ) ) { $ options [ "options" ] [ "max_range" ] = $ max ; } // We really DO NOT need to validate user inputs like 010 or 0x10 // so this is not needed: $options["flags"] = FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX; // If in the code we use something like $this->int(010) this is the // same as $this->int(8) - so it will pass and return 8 // But if we read it from user input, a file etc, it should fail by // default. Example Right padding some currencies like 0010.00 USD return filter_var ( $ value , FILTER_VALIDATE_INT , $ options ) ; }
Validates integer value.

@param mixed   $value Integer or string
@param integer $min
@param integer $max
@param mixed   $default What to be returned if the filter fails

@return mixed
Validates integer value .