PHP Create Folder (mkdir) auto add number at Folder name? -


<?php    mkdir("testing", 0700); ?> 

i use code can create "testing" folder, hope when run code create folder each time ,it can auto add number @ folder name @ first. such

"1testing, 2testing, 3testing, 4testing.........."   

how it???

hope code helpful you.

at first go might solutions seems inefficient work sure without having database involvement.

note: keep on checking folder names till specific name available

<?php ini_set('display_errors', 1); $counter=1; $path="/path/to/folder/test"; while(is_dir($path)) {     $path="/path/to/folder/{$counter}test";     $counter++; } mkdir($path); 

this create directory when have appropriate permissions, else end with.

warning: mkdir(): permission denied


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -