What potential issues can arise when creating nested directories in PHP using mkdir()?

When creating nested directories in PHP using mkdir(), one potential issue that can arise is that the parent directories may not exist. To solve this issue, you can set the third parameter of mkdir() to true, which will create the parent directories as needed.

<?php
// Create nested directories with parent directories as needed
$nestedDir = 'parent/child/grandchild';
mkdir($nestedDir, 0777, true);
?>