I want to know when it comes to uploading a file, like this:
$destino = 'imagens/' . $novoNome;
Is there a difference between imagens/
and imagens\
?
I want to know when it comes to uploading a file, like this:
$destino = 'imagens/' . $novoNome;
Is there a difference between imagens/
and imagens\
?
Depends on context. If it's for use as a directory separator, PHP abstracts this and uses whatever works best for the platform it's running. It does not mean that it will always work as expected, but in general it is so. It is usually preferred to use the normal bar rather than the inverted one. Some people prefer to use DIRECTORY_SEPARATOR
or even create functions to abstract the use of paths .
If it's just a normal string it makes a lot of difference in some cases. The normal bar is just a bar, the backslash is an indication that the next character is special, so a \n
is to skip a line, \t
is a tab or \
is when you want the backslash to be used as a normal character. But this depends on whether you are using single or double quotes , in the case of the simple one used the one time the inverted one does something different is when you use \'
to indicate that you are not closing the string and rather want an apostrophe to be used.