There is no single function build into PHP that would allow this, you have to write your own with rmdir and unlink.
An example (taken from a comment on php.net docs):
// ensure $dir ends with a slash
function delTree($dir) {
$files = glob( $dir . '*', GLOB_MARK );
foreach( $files as $file ){
if( substr( $file, -1 ) == '/' )
delTree( $file );
else
unlink( $file );
}
rmdir( $dir );
}
?>