1

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?

Huseyin
  • 1,499
  • 2
  • 25
  • 39

1 Answers1

1

stringyfy your arguments like

MakeDir("test",'0777');
function MakeDir($dir,$mode='0777'){
    echo $mode;
}
Lal krishnan S L
  • 1,684
  • 1
  • 16
  • 32
  • Your answer works for echo, print etc. But it returns wrong results when a directory would be created. – Huseyin Jun 10 '15 at 10:38