In many situations, we need to make the filename different on the server when creating them to prevent duplication. And the most common answer to that seems to be, append th
All these answers seem overkill:
$k = 0; while(!$result){ if(!file_exists("file[$k].ext")) $result = "file[$k].ext"; $k++; } makefile($result);