String get between
Returns the content between $start and $end
function GetBetween($content,$start,$end){
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
//Example:
GetBetween('foo test bar', 'foo', 'bar');
// --> returns ' test ';
Url: http://www.jonasjohn.de/snippets/php/get-between.htm
Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013