Create a file named foldercreate.php and paste the following code in it to see the result. <?php // Desired folder structure $structure = './depth1/depth2/depth3/'; // To create the nested structure, the $recursive parameter