Get substring between two strings

PHOTO EMBED

Fri Mar 12 2021 08:24:20 GMT+0000 (UTC)

Saved by @coenvdbrink #php

function get_string_between($string, $start, $end){
    $string = ' ' . $string;
    $ini = strpos($string, $start);
    if ($ini == 0) return '';
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}
content_copyCOPY