public static function check ($path, $fd, $rw)
    {
        if ($fd == 'f') {
            if (is_file($path) != true) {
                return false;
            }
        } elseif ($fd == 'd') {
            if (is_dir($path) != true) {
                return false;
            }
        } else {
            return false;
        }

        if ($rw == 'r') {
            if (!is_readable($path)) {
                return false;
            }
        } elseif ($rw == 'w') {
            if (!is_writable($path)) {
                return false;
            }
        } elseif ($rw == 'rw') {
            if (!is_readable($path) || !is_writable($path)) {
                return false;
            }
        } else {
            return false;
        }

        return true;
    }
public static function check ($path, $fd, $rw)
    {
        if ($fd == 'f') {
            if (is_file($path) != true) {
                return false;
            }
        } elseif ($fd == 'd') {
            if (is_dir($path) != true) {
                return false;
            }
        } else {
            return false;
        }

        if ($rw == 'r') {
            if (!is_readable($path)) {
                return false;
            }
        } elseif ($rw == 'w') {
            if (!is_writable($path)) {
                return false;
            }
        } elseif ($rw == 'rw') {
            if (!is_readable($path) || !is_writable($path)) {
                return false;
            }
        } else {
            return false;
        }

        return true;
    }
public static function check ( $ path , $ fd , $ rw ) { if ( $ fd == 'f' ) { if ( is_file ( $ path ) != true ) { return false ; } } elseif ( $ fd == 'd' ) { if ( is_dir ( $ path ) != true ) { return false ; } } else { return false ; } if ( $ rw == 'r' ) { if ( ! is_readable ( $ path ) ) { return false ; } } elseif ( $ rw == 'w' ) { if ( ! is_writable ( $ path ) ) { return false ; } } elseif ( $ rw == 'rw' ) { if ( ! is_readable ( $ path ) || ! is_writable ( $ path ) ) { return false ; } } else { return false ; } return true ; }
Checks a file or directory existence and readability

@param string $path /path/to/dir/or/file
@param string $fd Either 'f' for file or 'd' for directory.
@param string $rw Either 'w' for a check on writability or 'r' for a check on readability.

@return bool
Checks a file or directory existence and readability