Delete All Files Inside Folder

<?php
 $dir="folderdirctory/";
 if(file_exists($dir)){
       foreach(glob($dir.'*.*') as $files){
              unlink($files);
       }
 }
?>