Question: I have two strings in PHP:

```
$Str1 = "/welcome/files/birthday.php?business_id=0";
$Str2 = "/welcome/index.php?page=birthday";

```

I have to get word birthday from this two string with a single function.
I need a function which returns birthday on both case.

example

```
function getBaseWord($word){ 
    ...
    return $base_word;
}

getBaseWord('/welcome/files/birthday.php?business_id=0');
getBaseWord('/welcome/index.php?page=birthday');

```

both function call should return "birthday".

How can i do it.

Answer: 
So what you will need to do is get all of the actual GET variables extracted from the string:

```
//Seperate the URL and the GET Data
list($url,$querystring) = explode('?', $string, 2);

//Seperate the Variable name from its value
list($GETName, $GETValue) = explode("=", $querystring);

//Check to see if we have the right variable name
if($GETName == "page"){
    //Return the value of that variable.
    return $GETValue;
}

```

**NOTE**

This is very BASIC and will not accept more then one GET parameter. You will need to modify it if you plan on have more variables.
I have no idea what you are talking about but, you can cut the word "birthday" with str\_replace and replace with another word, or you can find the position with stripos, I have no idea what we are trying to do here, so those are the only things come to my mind