For example like this...
<?php
$foo = 'some.stupid.name.exe';
$variable = substr( $foo, strrpos( $foo, '.' ) + 1 ); // Now stored in $variable
echo $variable; // Output: exe
?>
Or like this...
<?php
$foo = 'some.stupid.name.exe';
$parts = explode( '.', $foo );
$variable = $parts[count( $parts ) - 1]; // Now stored in $variable
echo $variable; // Output: exe
?>