this php code will strip the extension from a filename.
to remove the extension just call the function with the name of the file

strip file extension” makes use of the built-in PHP functions strrchr( ), substr( ), strlen( ), end( ) and explode( ).

01 <?php
02  
03 function strip_ext($name)
04 {
05     $ext = strrchr($name, '.');
06     if($ext !== false)
07     {
08         $name = substr($name, 0, -strlen($ext));
09     }
10     return $name;
11 }
12  
13 // demonstration
14 $filename = 'file_name.txt';
15  
16 echo '
17 <p>
18     the filename without extension:<br />
19     '.strip_ext($filename).'
20 </p>';
21  
22 // to get the file extension, do
23 echo '
24 <p>
25     the file extension:<br />
26     '.end(explode('.',$filename)).'
27 </p>';
28  
29  
30 ?>