Skip to content

Instantly share code, notes, and snippets.

@kevinmarks
Last active March 15, 2019 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinmarks/ba16e408b1093f23ff72d6536456dd0f to your computer and use it in GitHub Desktop.
Save kevinmarks/ba16e408b1093f23ff72d6536456dd0f to your computer and use it in GitHub Desktop.
non recursive create_folder
function create_folder($path, $slug)
{
$folderPath = $basePath = $path . $slug;
$counter=0;
while (file_exists($folderPath){
$counter++;
$folderPath = $basePath . "-$counter";
}
mkdir($folderPath); //Creates the folder
$fn = $folderPath . '/listen.md'; //Sets the filename
return $fn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment