<?Php
function my_strip($start,$end,$total){
$total = stristr($total,$start);
$f2 = stristr($total,$end);
return substr($total,strlen($start),-strlen($f2));
}
function my_strip2($start,$end,$total){ // includes both landmarks
$total = stristr($total,$start);
$f2 = stristr($total,$end);
return substr($total,0,(strlen($total)-(strlen($f2) - strlen($end))));
}
/////////////////////
$string="You are welcome to plus2net.com. Use this site for your learning of web programming and design , php is one of the programming language";
$contents=my_strip("welcome","programming",$string);
echo $contents;
echo "<br>";
$contents=my_strip2("welcome","programming",$string);
echo $contents;
?>
The first function will display part of the string without the landmarks ( welcome and programming ) but second function will keep them at starting and at end. <type>PHP programmer</type>
<name>Your name is here</name>
Here we can use <name> and </name> as two landmark points to extract the name from the above string.
RottNKorpse | 19-09-2009 |
Thanks a lot for this...exactly what I was looking for. |
elden walden | 30-01-2010 |
great info-will use to change data in classified ad app. |
prakash | 07-01-2013 |
very good information really it helped me. |