benanamen Posted September 9, 2018 Share Posted September 9, 2018 !!!!!!!!! Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 9, 2018 Share Posted September 9, 2018 I say - Read Any Book At All. Do Some Learning. Quote Link to comment Share on other sites More sharing options...
gizmola Posted September 9, 2018 Share Posted September 9, 2018 On 9/8/2018 at 9:31 AM, phpsane said: Which one of these 2 I should stick to ? mkdir("$directory_path" . "$user", "$mode", TRUE); //Originally I had it like this. That param inputs should be inside dbl quotes. mkdir($directory_path . $user . $mode, TRUE); // I now reckon, I should stick to this. Param inputs should not be quoted atall. be it sngl quote or dbl. What you say ? Correct. This is what was told to you initially when this was brought up. You don't need the double quotes UNLESS you are trying to INTERPOLATE the variables together into one or more strings. I showed you how you could get to the same result (concatenating multiple string variables and/or string constants together using '.' OR Using INTERPOLATION (Variables and string constant snippets inside of " ". Also -- because code compiles (doesn't create an error) does not mean that it is CORRECT. Mkdir is looking for a STRING that represents the correct path to the directory you want to create. If you feed it this input: $user = 'bob smith'; mkdir('O M G $ 779/' . '$user', 0777, TRUE); Then the final path variable is going to be 'O M G $ 779/$user' That is a string. It might even be accepted by the operating system as a legitimate path, and you may end up with a directory created: O M G $ 779/ And inside of it will be another directory: $user That might work, but it certainly isn't what you intended. I also think you should note, that you should always check the result of an operation like mkdir() because otherwise you have no idea if it worked or not. if (mkdir('O M G $ 779/' . '$user', 0777, TRUE)) { // Proceed } else { echo "Unable to create the Directory"; } Quote Link to comment Share on other sites More sharing options...
Barand Posted September 9, 2018 Share Posted September 9, 2018 On 9/8/2018 at 5:31 PM, phpsane said: mkdir($directory_path . $user . $mode, TRUE); // I now reckon, I should stick to this. Param inputs should not be quoted atall. be it sngl quote or dbl. What you say ? That is correct ony in the removal of the quotes. However your inabilty to distinguish beween a "." and a "," makes it incorrect. Try mkdir($directory_path . $user , $mode, TRUE); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.