I'm looking for a way to retrieve the text in between *& &* and put it's content into a $var. for each occurrence with in a string.
$occu[0] = "dsfsdf";
$occu[1] = "10";
$occu[2] = "10sct";
Is there a way to do this ?
I know how to do it but not recusively.
Code: Select all
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);
}
$parsed = get_string_between($tache, "*&", "&*");
$tache = str_replace("*&","<div class=\"progress-containers\"><div style=\"width:",$tache);
$tache = str_replace("&*","%\">$parsed</div></div>",$tache);Can somebody can give me a tips ?