Issue
I would like to create a directory $one with the permissions of $another:
mkdir($one, fileperms($another));
It seems to me that the above could doesn't work correctly. Please help me find the problem.
I also tried:
mkdir($one);
chmod($one, fileperms($another));
edit to clarify
$one = "/tmp/somedir"
$another = "/tmp/anotherdir"
Solution
fileperms($another)
is not returning what you expect it to, there is much more information than you need.
From the docs -
on most platforms the return value will also include information on the type of file given as filename.
To account for that you'll have to get the substring you need from fileperms()
$one = "/tmp/somedir";
$another = "/tmp/anotherdir";
mkdir($one, substr(fileperms($another), -4));
Answered By - Jay Blanchard Answer Checked By - Katrina (WPSolving Volunteer)