Skip to content

Instantly share code, notes, and snippets.

@cp6
Created July 12, 2019 01:04
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 cp6/94ff56da789b2d1072b4d05974547be7 to your computer and use it in GitHub Desktop.
Save cp6/94ff56da789b2d1072b4d05974547be7 to your computer and use it in GitHub Desktop.
Create directory based on Year, Month and Day PHP
<?php
function create_date_dir($start_dir = ''){
$year = date("Y");
$month = date("m");
$day = date("d");
$directory = "".$start_dir."$year/$month/$day/";
if(!is_dir($directory)){
mkdir($directory, 755, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment