• PHP Video Tutorials

PHP - xattr get() Function



xattr_get() function can get an extended attribute.

Syntax

string xattr_get( string $filename , string $name [, int $flags = 0 ] )

xattr_get() function can get a value of an extended attribute of a file.

The extended attributes have two different namespaces: user and root. The user namespace can be available to all users, while a root namespace is available only to users with root privileges. xattr can operate on a user namespace by default, but we can change it by using the flags argument.

xattr_get() function can return a string containing the value, or false if an attribute can't exist.

Example

<?php
   $file = "/usr/local/sbin/some_binary";
   $signature = xattr_get($file, "Root signature", XATTR_ROOT);
?>
php_function_reference.htm
Advertisements