public static function get($name, $type='string', $default=NULL) {

		$val = "";

		switch ($_SERVER['REQUEST_METHOD']) {

			case 'GET':
				$request = &$_GET;
				break;
				
			case 'POST':
				$request = &$_POST;
				break;
			
			default:
				$request = &$_REQUEST;
				break;
				
		}
					
		// remove [] from array
		if (substr($name, -2) == '[]') {
			$name = substr($name, 0, -2);
		}
		
		// seeking a possible name
		if (array_key_exists($name, $request)) {
			
			// evaluates whether it’s an array
			if (is_array($request[$name])) {
				
				$values = array();

				foreach ($request[$name] as $val) {
					$values[] = self::castTo($val, $type);
				}
				
				return $values;

			} else {

				return self::castTo($request[$name], $type);

			}

		} else {

			return self::castTo($default, $type);

		}
		
	}
public static function get($name, $type='string', $default=NULL) {

		$val = "";

		switch ($_SERVER['REQUEST_METHOD']) {

			case 'GET':
				$request = &$_GET;
				break;
				
			case 'POST':
				$request = &$_POST;
				break;
			
			default:
				$request = &$_REQUEST;
				break;
				
		}
					
		// remove [] from array
		if (substr($name, -2) == '[]') {
			$name = substr($name, 0, -2);
		}
		
		// seeking a possible name
		if (array_key_exists($name, $request)) {
			
			// evaluates whether it’s an array
			if (is_array($request[$name])) {
				
				$values = array();

				foreach ($request[$name] as $val) {
					$values[] = self::castTo($val, $type);
				}
				
				return $values;

			} else {

				return self::castTo($request[$name], $type);

			}

		} else {

			return self::castTo($default, $type);

		}
		
	}
public static function get ( $ name , $ type = 'string' , $ default = NULL ) { $ val = "" ; switch ( $ _SERVER [ 'REQUEST_METHOD' ] ) { case 'GET' : $ request = & $ _GET ; break ; case 'POST' : $ request = & $ _POST ; break ; default : $ request = & $ _REQUEST ; break ; } // remove [] from array if ( substr ( $ name , - 2 ) == '[]' ) { $ name = substr ( $ name , 0 , - 2 ) ; } // seeking a possible name if ( array_key_exists ( $ name , $ request ) ) { // evaluates whether it’s an array if ( is_array ( $ request [ $ name ] ) ) { $ values = array ( ) ; foreach ( $ request [ $ name ] as $ val ) { $ values [ ] = self :: castTo ( $ val , $ type ) ; } return $ values ; } else { return self :: castTo ( $ request [ $ name ] , $ type ) ; } } else { return self :: castTo ( $ default , $ type ) ; } }
Get data by POST or GET array returning the specified type or default value. In case
of not found, return default value. Manage array inputs.

@param	string	HTTP parameter name.
@param	string	Type string -default-, int, bool, date or datetime will be casted.
@param	string	Default value to return, in case of null or empty.

@return	multitype
Get data by POST or GET array returning the specified type or default value . In case of not found return default value . Manage array inputs .