I am using a PHP function to get all content between two delimiters in a string. However, if I have multiple occurrences of the string, it only picks up the first one. For example I'll have:
|foo| hello |foo| nothing here |foo| world |foo|
and the code will only out put "hello." My function:
function get_string_between($string, $start, $end){
$string = ' ' . $string;
$ini = stripos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = stripos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}