That's for Linux only. For Windows, you'll have to use:
exec("attrib +something -something file.txt");
Use + to add something, or - to erase something.
Codes to use:
H - Hidden
A - Archive
S - System
R - Read Only
For instance:
attrib -h -a -s -r file.txt
This erases every attribute off the file.