Another way is to use the switch() statement/control structure.
And, even another way would be to create an array and see if the extension is in that array (or not)...
THis example presupposes that the $exten variable is already set:
<?php
// create an array of acceptable file types for your app:
$acceptable_files = array('gif', 'jpg', 'png');
if(!in_array($exten, $acceptable_files))
{
// trigger error here:
die('no way!');
}
else
{
// OK to proceed:
echo 'cool....';
}
?>