I have a large string and I need to remove something like this from it:
<post user='test' id='test'></post>
test
can be any value. I known that you can do this with regex
. But I need this to be a standard PHP execution, as my server cannot support regex
due to the amount of users.
Anyone got any ideas; any help would be appreciated.
Using strpos
and substr
like this:
while(($startPos = strpos($html, '<post')) !== FALSE && ($endPos = strpos($html, '</post>', $startPos)) !== FALSE){
$html = substr($html, 0, $startPos) . substr($html, $endPos + strlen('</post>'));
}
Try to use explode function.
explode("'", $string);