使用php codeigniter排除文件夹中文件数量不同扩展名的文件? count(*格式,此格式除外(webm))

I want to get number of video files in a folder suppose .mp4,.mp3,.flv..etc extension and exclude files like .webm extension.How to do this with php condeigniter?

Write a custom function like this

function getCount(){
$overAllCount = 0;
$directory = base_url().'uploads';
$mp4count = glob($directory . '*.mp4');
$mp3count = glob($directory . '*.mp3');
$flvcount = glob($directory . '*.flv');

if ( $mp4count !== false )
{
    $filecount = count( $mp4count );
    $overAllCount += $filecount;
}
if ( $flvcount !== false )
{
    $filecount = count( $flvcount );
    $overAllCount += $filecount;
}
if ( $mp3count!== false )
{
    $filecount = count( $mp3count);
    $overAllCount += $filecount;
}
return $overAllCount;
}