# Strstr

**URL:** <https://forum.kirupa.com/t/strstr/180933>\
**Category:** Uncategorized\
**Created:** [March 4, 2006, 7:23pm UTC](https://forum.kirupa.com/t/strstr/180933 "2006-03-04T19:23:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Templarian](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/templarian/32/7152_2.png) [@Templarian](https://forum.kirupa.com/u/Templarian)\
**Post date:** [March 4, 2006, 7:23pm UTC](https://forum.kirupa.com/t/strstr/180933/1 "2006-03-04T19:23:19Z")

</div>

I use this to find extentions like “file.txt” would show “.txt”, but cant find out how to get the “file” by itself.

function GetFileExtention($filename) {  
$ext = strstr($filename,".");  
return $ext;  
}

I’ve been searching for the last half any hour how to find out of “file.txt” the string “file”.

//edit, Basically I need everything before the “.”.

Thanks.
