- pathinfo: documentation ( source)
- in_array: documentation ( source)
- strtolower: documentation ( source)
<?php
$bad_extensions = array( 'html' , 'js' , 'gif' , 'png', 'php','jpg', 'jpeg','xml', 'txt','zip','bak' );
$file_name = '2-E-Book à télécharger.php';
$fileinfo = pathinfo($file_name);
if ( !in_array(strtolower($fileinfo["extension"]), $bad_extensions) )
echo "pouet";
else
echo "sblitch";