Folder permissions would changed in cross functions

42 views Asked by At

I have following code in php and I want make a simple directory with user defined permissions.

MakeDir("test",0777);
function MakeDir($dir,$mode=0777){
    echo $mode;
    mkdir($dir, $mode) ;  
}

for 0777 function returns 511, and for 0666 it returns 438. How can I protect main input for chmode or mkdir command?

1

There are 1 answers

1
Lal krishnan S L On

stringyfy your arguments like

MakeDir("test",'0777');
function MakeDir($dir,$mode='0777'){
    echo $mode;
}