xattr_remove
PHP function
Edit on GitHub ✎
(PECL xattr >= 0.9.0)
Remove an extended attribute
Description
xattr_remove(string $filename, string $name, int $flags = 0): bool
This function removes an extended attribute of a file.
Namespace
Parameters
filenameThe file from which we remove the attribute.
nameThe name of the attribute to remove.
flagsXATTR_DONTFOLLOWDo not follow the symbolic link but operate on symbolic link itself. XATTR_ROOTSet attribute in root (trusted) namespace. Requires root privileges.
Return Values
Success
Examples
Removes all extended attributes of a file
php
<?php
$file = 'some_file';
$attributes = xattr_list($file);
foreach ($attributes as $attr_name) {
xattr_remove($file, $attr_name);
}
?>