title: Change font color for each word in a string (JS or PHP)
body: <p>I've searched but cannot find a solution to increment the font color (eg. lightness +10%) for each of 3 or 4 words in a title. The font color will be initially set in SCSS with a color var.</p>
  
  <p><strong>Example Title:</strong></p>
  
  <blockquote>
    <p>Here Is My New Title</p>
  </blockquote>
  
  <p>In this example, lets say the title was 'dark blue'.. the words would be:</p>
  
  <pre><code>Here = darker blue
  Is = navy blue
  My = medium blue
  New Title = light blue
  </code></pre>
  
  <p>There is a similar post here: <a href="https://stackoverflow.com/questions/22545318/javascript-text-color-change-to-each-word-in-array">JavaScript Text Color Change To Each Word In Array</a> but this is searching for keywords in an array, not each word of a string.</p>
  
  <p>I've also come across basic CSS/HTML only solutions like this, which won't work: <a href="https://stackoverflow.com/questions/4622808/html-changing-colors-of-specific-words-in-a-string-of-text">HTML: Changing colors of specific words in a string of text</a></p>
  
  <p><strong>NOTE:</strong>
  I will be returning the title (string) in a php variable - in case there is a solution in PHP.</p>
  
  <p><strong>GOAL:</strong> I need to increment the font color (or even wrap consecutive words in spans and increment the SCSS var) for each word in a string.. open to suggestions.</p>
  
  <p><strong>UPDATE</strong>
  I've added a jsfiddle link (<a href="http://jsfiddle.net/revive/xyy04u7d/" rel="nofollow noreferrer">http://jsfiddle.net/revive/xyy04u7d/</a>) to show the JS implementation, thanks to Tushar, with some changes to include ampersands in the regex.</p>
  
  <p>Here is the <strong>PHP implementation</strong>:</p>
  
  <pre><code>&lt;?php
      $title = "SIMPLE TITLE &amp; WITHOUT COLORS";
      $words   = preg_split('/\s+(?!&amp;)/', $title);
  ?&gt; 
  &lt;h3 class="colors blue"&gt;
  &lt;?php foreach($words as $word):?&gt;
      &lt;span&gt;&lt;?php echo $word; ?&gt;&lt;/span&gt;
  &lt;?php endforeach; ?&gt;
  &lt;/h3&gt;
  </code></pre>