becu Posted April 12, 2006 Share Posted April 12, 2006 ok, here's my problem:$string = '<abc tag="test">sumtext goes here</abc>this is not supposed to show<abc>some more text goes here</abc>';What should I do so I will only get everything inside [b]<abc[/b] and [b]</abc>[/b] tag?preg_match didn't not work because it will pull out everything including "this is not supposed to show"Thank you. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 12, 2006 Share Posted April 12, 2006 Try[code]$string = '<abc tag="test">sumtext goes here</abc>this is not supposed to show<abc>some more text goes here</abc>';$res = array();$p3 = $p2 = 0;while (($p1 = strpos($string, '<abc', $p3)) !== false) { $p2 = strpos($string,'>',$p1); $p3 = strpos($string,'</abc>',$p2); $res[] = substr($string,$p2+1, $p3-$p2-1);}echo join ('<br />', $res);[/code] Quote Link to comment Share on other sites More sharing options...
becu Posted April 15, 2006 Author Share Posted April 15, 2006 Hi Barand,Thank you so much for your help!I really appreciate it!Thanks again.Have a great day! I will sure ask for help again :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.