View Single Post
Old 02-21-2011, 07:10 AM   #1 (permalink)
Peuplarchie
The Acquainted
 
Peuplarchie's Avatar
 
Join Date: May 2008
Location: Québec
Posts: 104
Thanks: 10
Peuplarchie is on a distinguished road
Application 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 !
Peuplarchie is offline  
Reply With Quote