title: How do you split a string into word pairs?
body: <p>I am trying to split a string into an array of word pairs in PHP. So for example if you have the input string:</p>
  
  <pre><code>"split this string into word pairs please"
  </code></pre>
  
  <p>the output array should look like</p>
  
  <pre><code>Array (
      [0] =&gt; split this
      [1] =&gt; this string
      [2] =&gt; string into
      [3] =&gt; into word
      [4] =&gt; word pairs
      [5] =&gt; pairs please
      [6] =&gt; please
  )
  </code></pre>
  
  <p>some failed attempts include:</p>
  
  <pre><code>$array = preg_split('/\w+\s+\w+/', $string);
  </code></pre>
  
  <p>which gives me an empty array, and</p>
  
  <pre><code>preg_match('/\w+\s+\w+/', $string, $array);
  </code></pre>
  
  <p>which splits the string into word pairs but doesn't repeat the word. Is there an easy way to do this? Thanks.</p>