I need to parse an HTML document and to find all occurrences of string asdf in it.
asdf
I currently have the HTML loaded into a string variable. I would just
function getocurence($chaine,$rechercher) { $lastPos = 0; $positions = array(); while (($lastPos = strpos($chaine, $rechercher, $lastPos))!== false) { $positions[] = $lastPos; $lastPos = $lastPos + strlen($rechercher); } return $positions; }