Extract String Between Two Given Demiliters - PHP

by Ramya 2012-05-29 14:15:33

Extract String Between Two Given Demiliters - PHP

To extract "String Between Two Given Demiliters", use the following php function,
$text = "This is a (test content)";
function getStringBet($text,$stdem,$endem){
$extract = explode($stdem, $text);
if (isset($extract[1])){
$extract = explode($endem, $extract[1]);
return $extract[0];
}
return '';
}
echo $maxlng = getStringBet("$text", "(", ")");
572
like
0
dislike
0
mail
flag

You must LOGIN to add comments