Just to be clear here, you can pass mkdir() a relative filesystem path, but you can not pass it any kind of URL. Depending on what you want to accomplish and where the script is running, you could use a relative path something like:
mkdir("../subdir/$username", 0755);
Along the lines of what bpat described above, you could make an absolute path as:
mkdir($_SERVER['DOCUMENT_ROOT'] . "/subdir/$username", 0755);