02-21-2011, 06:10 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: May 2008
Location: Québec
Posts: 103
Thanks: 10
|
Put in seperate $var content whats in between *&&*
Good day to you all,
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.
PHP Code:
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 ?
__________________
That's why we are not alone on earth... let's build !
|
|
|
|