<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Mon, 20 May 2013 13:00:42 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Hasin Hayder's Blog: Counting occurrence of a word in a String - Benchmarking of PHP functions]]></title>
      <guid>http://www.phpdeveloper.org/news/7732</guid>
      <link>http://www.phpdeveloper.org/news/7732</link>
      <description><![CDATA[<p>
In an effort to add to the ever-growing list of "keeping it simple" benchmarks out there, <i>Hasin Hayder</i> presents <a href="http://hasin.wordpress.com/2007/04/30/counting-occurrence-of-a-word-in-a-string-benchmarking-of-php-functions/">his own results</a> for the task of fining the number of times a word occurs in a given string.
</p> 
<blockquote>
Today I was just thinking what are the possible ways to count the occurrence of a specific word inside a string. I found some possible ways finally and I just benchmarked them. Wanna see the result?? - for sure you will find it interesting too.
</blockquote>
<p>
Methods range from a simple split() and count() call out to using the regular expression functions to locate the matches. After running it four times (to check for accuracy), he the stats were pretty much the same. It looks like the substr+count method was the fastest overall with last place falling to the array function method.
</p>]]></description>
      <pubDate>Mon, 30 Apr 2007 10:42:00 -0500</pubDate>
    </item>
  </channel>
</rss>
