How to create folder if it does not exists in Php?

The function creates a directory specified by a pathname if it does not exists in PHP.

1. Code:

 <?php
function createFolderIfNotExistedInPhp($folderPath){
		if (!file_exists($folderPath)) {
			mkdir($folderPath, 0777, true);
		}
	}
	echo createFolderIfNotExisted("D:/soltuts.txt");
?>

2. Example:

Input:

File input: "D:/soltuts.txt"

Output:

The function creates a directory specified by a pathname if it does not exists