从.env变量向PHP mkdir添加八进制位

I have an issue that when I try to load a permission string from my .env file in Laravel and then when I try to use it as an int for the file mode arg in mkdir it deletes the octal bit 0 and as a result the mkdir call gets messed up:

mkdir($this->bakDir, 0755);

Works fine.

echo(\Config::get('app.dbBackupDirPerms')); echo(intval(\Config::get('app.dbBackupDirPerms')));

mkdir($this->bakDir, intval(\Config::get('app.dbBackupDirPerms')));

0755

755

Creates the directory but with the incorrect permissions

Passing \Config::get('app.dbBackupDirPerms'); as a string also doesn't work to my surprise, I figured it would not be type checked by mkdir

Is there anyway around this, am I missing something here? Relatively new to PHP, but I imagine this must be a relatively common occurrence.

you need to convert your int to octal

mkdir($this->bakDir, intval(\Config::get('app.dbBackupDirPerms'), 8 ));