A simple method for recursively deleting a directory and all its content in PHP:-

function removeDirectory($path) {

	$files = glob($path . '/*');
	foreach ($files as $file) {
		is_dir($file) ? removeDirectory($file) : unlink($file);
	}
	rmdir($path);

	return;
}
To use simply pass the path to the directory you want to remove:-

removeDirectory('/path/to/directory');