static function IsReadableAndWritable($filename,&$error = null,&$error_str = null){
		$error = false;
		$error_str = "";

		settype($filename,"string");

		if(!file_exists($filename)){
			$error = true;
			$error_str = "file does't exist";
			return 0;
		}

		$_UID_ = posix_getuid();
		$_FILE_OWNER = fileowner($filename);
		$_FILE_PERMS = fileperms($filename);
		if(!(
			(($_FILE_OWNER!=$_UID_) && (((int)$_FILE_PERMS&(int)bindec("110")))==(int)bindec("110")) ||
			(($_FILE_OWNER==$_UID_) && (((int)$_FILE_PERMS&(int)bindec("110000000"))==(int)bindec("110000000")))
		)){
			return 0;
		}
		return 1;
	}
static function IsReadableAndWritable($filename,&$error = null,&$error_str = null){
		$error = false;
		$error_str = "";

		settype($filename,"string");

		if(!file_exists($filename)){
			$error = true;
			$error_str = "file does't exist";
			return 0;
		}

		$_UID_ = posix_getuid();
		$_FILE_OWNER = fileowner($filename);
		$_FILE_PERMS = fileperms($filename);
		if(!(
			(($_FILE_OWNER!=$_UID_) && (((int)$_FILE_PERMS&(int)bindec("110")))==(int)bindec("110")) ||
			(($_FILE_OWNER==$_UID_) && (((int)$_FILE_PERMS&(int)bindec("110000000"))==(int)bindec("110000000")))
		)){
			return 0;
		}
		return 1;
	}
static function IsReadableAndWritable ( $ filename , & $ error = null , & $ error_str = null ) { $ error = false ; $ error_str = "" ; settype ( $ filename , "string" ) ; if ( ! file_exists ( $ filename ) ) { $ error = true ; $ error_str = "file does't exist" ; return 0 ; } $ _UID_ = posix_getuid ( ) ; $ _FILE_OWNER = fileowner ( $ filename ) ; $ _FILE_PERMS = fileperms ( $ filename ) ; if ( ! ( ( ( $ _FILE_OWNER != $ _UID_ ) && ( ( ( int ) $ _FILE_PERMS & ( int ) bindec ( "110" ) ) ) == ( int ) bindec ( "110" ) ) || ( ( $ _FILE_OWNER == $ _UID_ ) && ( ( ( int ) $ _FILE_PERMS & ( int ) bindec ( "110000000" ) ) == ( int ) bindec ( "110000000" ) ) ) ) ) { return 0 ; } return 1 ; }
Checks if a file is both readable and writable.

@param string 	$filename Name of a file
@param boolean 	&$error Error flag
@param string 	&$error_str Error description
@return int	1 - is readable and writable; 0 - is not
Checks if a file is both readable and writable .