<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1046178" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1046178</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Ok so I figured this out. </title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/trying-find-keywords-text-and-count-amount-times-occurin#comment-1247387</link>
    <description> &lt;p&gt;Ok so I figured this out.  First I replace all occurances of HTML tags with spaces using this function:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;function striptags ($str) {&lt;br /&gt; return trim(strip_tags(str_replace(&amp;#039;&amp;lt;&amp;#039;, &amp;#039; &amp;lt;&amp;#039;, $str)));&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
and then use the below while loop and preg_match_all using the given regex (\b either side is the key) to count the amount of times the keyword occurs:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp; while($row = mysql_fetch_array($query)){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (preg_match(&amp;quot;/\b$row[0]\b/i&amp;quot;,$url) &amp;gt; 0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $count = preg_match_all(&amp;quot;/\b$row[0]\b/i&amp;quot;,$url,$match);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $s[$x] = array(&amp;#039;word&amp;#039;=&amp;gt;$row[0],&amp;#039;occur&amp;#039;=&amp;gt;$count); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $x++;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 Feb 2010 12:12:37 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1247387 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
