Forum Moderators: coopster
eg <tag1>Text I want</tag1>
I can do it but it seems really long winded. Is there a quick and easy way to do this maybe using reg expressions.
Also I only have access to standard libraries.
Thanks in advance
Chris
Lets say you have:
$text="<tag1>Text I want</tag1>";
Then you can do the work with:
$textiwant=strip("<tag1>","</tag1>",$text,$pos=0);
My function:
function strip($f1,$f2,$text,&$pos){
if(!is_integer($pos)){$pos=false;return false;}
$pos1=strpos($text,$f1,$pos);
if(!is_integer($pos1)){$pos=false;return false;}
$pos1+=strlen($f1);
$pos2=strpos($text,$f2,$pos1);
if(!is_integer($pos2)){$pos=false;return false;}
$res=substr($text,$pos1,$pos2-$pos1);
$pos=$pos2+strlen($f2);
return $res;
}