title: Convert substr filter from character count to word count
body: <p>I'm using the getExcerpt() function below to dynamically set the length of a snippet of text. However, my substr method is currently based on character count. I'd like to convert it to word count. Do I need to separate function or is there a PHP method that I can use in place of substr?</p>
  
  <pre><code>function getExcerpt()
  {
      //currently this is character count. Need to convert to word count
      $my_excerptLength = 100; 
      $my_postExcerpt = strip_tags(
          substr(
              'This is the post excerpt hard coded for demo purposes',
              0,
              $my_excerptLength 
              )
          );
      return ": &lt;em&gt;".$my_postExcerpt." [...]&lt;/em&gt;";}
  }
  </code></pre>