Get in between text using SafGetInBetweenText

<?
//This is a small script I have created for testing, hope it will help for you.
//if you give the start & end text it will give you in between text as out put
//So output is "hope it will help for you."
function SafGetInBetweenText($start,$end,$text){
list(
$Waste,$GoodText) = explode("$start",$text);
list(
$GoodText,$Waste) = explode("$end",$GoodText);
return
$GoodText;
}

$text = "This is a small script I have created for testing, hope it will help for you. if you give the start & end text it will give you in between text as output";
$start = "testing,";
$end = "if you";
print
SafGetInBetweenText($start,$end,$text);
?>