Get the Text between end

Get the Text between end

Language:: PHP
Type:: snippet Back-end

This is the kind of function every web developer should have in their toolbox for future use: give it a string, a start, and an end, and it will return the text contained with end.

function GetBetween($content, $start, $end){
    $r = explode($start, $content);
    if  (isset($r[1])){
        $r = explode($end, $r[1]);
        return  $r[0];
    }
    return  '';
}

Source: http://www.jonasjohn.de/snippets/php/get-between.htm