Change '0777' string to 0777 octal LITERALLY
My code is like $perm = "0777"; //this is fetch from the database chmod("myFolder/", $perm); but the value of $perm is not in octal, how can I change the data type of the variable to octal? even an alternative method will do As it was mentioned, there is no octal number type. And chmod function receive the second param as integer number. Implicit conversion of $perm does not assume that number is octal. So, you need convert your "octal string" to integer by using appropriate function. Just use octdec function $perm = "0777"; //this is fetch from the database chmod("myFolder/", octdec($perm));