RarEntry::getAttr

(PECL rar >= 0.1)

RarEntry::getAttrGet attributes of the entry

Description

public RarEntry::getAttr(): int

Returns the OS-dependent attributes of the archive entry.

Parameters

This function has no parameters.

Return Values

Returns the attributes or false on error.

Examples

Example #1 RarEntry::getAttr() example

<?php

$rar_file 
rar_open('example.rar') or die("Can't open Rar archive");

$entry rar_entry_get($rar_file'dir/in/the/archive') or die("Can't find such entry");

$host_os $entry->getHostOs();
$attr $entry->getAttr();

switch(
$host_os) {
    case 
RAR_HOST_MSDOS:
    case 
RAR_HOST_OS2:
    case 
RAR_HOST_WIN32:
    case 
RAR_HOST_MACOS:
        
printf("%c%c%c%c%c%c\n",
                (
$attr 0x08) ? 'V' '.',
                (
$attr 0x10) ? 'D' '.',
                (
$attr 0x01) ? 'R' '.',
                (
$attr 0x02) ? 'H' '.',
                (
$attr 0x04) ? 'S' '.',
                (
$attr 0x20) ? 'A' '.');
        break;
    case 
RAR_HOST_UNIX:
    case 
RAR_HOST_BEOS:
        switch (
$attr 0xF000)
        {
            case 
0x4000:
                
printf("d");
                break;
            case 
0xA000:
                
printf("l");
                break;
            default:
                
printf("-");
                break;
        }
        
printf("%c%c%c%c%c%c%c%c%c\n",
                (
$attr 0x0100) ? 'r' '-',
                (
$attr 0x0080) ? 'w' '-',
                (
$attr 0x0040) ? (($attr 0x0800) ? 's':'x'):(($attr 0x0800) ? 'S':'-'),
                (
$attr 0x0020) ? 'r' '-',
                (
$attr 0x0010) ? 'w' '-',
                (
$attr 0x0008) ? (($attr 0x0400) ? 's':'x'):(($attr 0x0400) ? 'S':'-'),
                (
$attr 0x0004) ? 'r' '-',
                (
$attr 0x0002) ? 'w' '-',
                (
$attr 0x0001) ? 'x' '-');
        break;
}

rar_close($rar_file);

?>

See Also

Here you can write a comment


Please enter at least 10 characters.
Loading... Please wait.
* Pflichtangabe
There are no comments available yet.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Category: Software & Web-Development

PHP cURL Tutorial: Using cURL to Make HTTP Requests

cURL is a powerful PHP extension that allows you to communicate with different servers using various protocols, including HTTP, HTTPS, FTP, and more. ...

TheMax

Autor : TheMax
Category: PHP-Tutorials

Midjourney Tutorial - Instructions for beginners

There is an informative video about Midjourney, the tool for creating digital images using artificial intelligence, entitled "Midjourney tutorial in German - instructions for beginners" ...

Mike94

Autor : Mike94
Category: KI Tutorials

Publish a tutorial

Share your knowledge with other developers worldwide

Share your knowledge with other developers worldwide

You are a professional in your field and want to share your knowledge, then sign up now and share it with our PHP community

learn more

Publish a tutorial