I want to create a subfolder inside mp3 with the name of $ts (the current timestamp) but php doesn't really allow me to do that.
This is my code:
$ts = time();
mkdir('\xampp\htdocs\mp3\$ts', 0777, true);
I have already tried:
$ts = time();
mkdir('\xampp\htdocs\mp3\'.$ts.'', 0777, true);
You are escaping the '
accidentally:
mkdir('\\xampp\\htdocs\\mp3\\'.$ts, 0777, true);
You can also use double quotes:
mkdir("\\xampp\\htdocs\\mp3\\{$ts}", 0777, true);
First, only in double quoted strings variables get interpolated.
$a = 'abc';
$b = 'abc$a'; // actual value abc$a
$c = "abc$a"; // actual value abcabc
seconds, this does not seem to be the full path. please provide full path and use slash instead of backslash, since backslash is used as an escape sequence (and in your second example it just escapes the quote and the actual value would be \xampp\htdocs\mp3.$ts. if there was no parse error ;)
Maybe try this:
mkdir("\xampp\htdocs\mp3\" . time() . "\", 0777, true);
simplest method i found:
$ts = time();
mkdir("\xampp\htdocs\mp3\$ts", 0777, true);