Last active
July 24, 2018 10:23
-
-
Save vpadhariya/e55c8f9620236de6e55edcc956912f36 to your computer and use it in GitHub Desktop.
Revisions
-
vpadhariya revised this gist
Jul 24, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php /** * Creates a directory according to given id and parent dir path * @params integer $id this id will decide which directory to return or create and then return -
vpadhariya created this gist
Jul 24, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ /** * Creates a directory according to given id and parent dir path * @params integer $id this id will decide which directory to return or create and then return * @params string $parent this will decide what is the path of the directory. */ function createDir($id, $parent) { $nd_dirlimit = 100; $mod = ceil($id / $nd_dirlimit) - 1; $dirs = $mod * $nd_dirlimit + 1; $dire = $dirs + $nd_dirlimit - 1; $tempDir = $dirs.'_'.$dire; if(!is_dir($parent.'/'.$tempDir)) mkdir($parent.'/'.$tempDir,0775); return $tempDir; }