xattr_set
xattr_set
Set an extended attribute
bool **xattr_set** string $filename string $name string $value int $flags
This function sets the value of an extended attribute of a file.
filenameThe file in which we set the attribute.
name
The name of the extended attribute. This attribute will be created if
it doesn't exist or replaced otherwise. You can change this behaviour
by using the parameter.
flags
valueThe value of the attribute.
flags
return.success
Voorbeeld: Sets extended attributes on file
<?php
$file = 'my_favourite_song.wav';
xattr_set($file, 'Artist', 'Someone');
xattr_set($file, 'My ranking', 'Good');
xattr_set($file, 'Listen count', '34');
/* ... other code ... */
printf("You've played this song %d times", xattr_get($file, 'Listen count'));
?>
xattr_get``xattr_remove