How can we split a sentence
<p>I have written the PHP code for getting some part of a given dynamic sentence, e.g. <code>"this is a test sentence"</code>:</p>

<pre><code>substr($sentence,0,12);
</code></pre>

<p>I get the output:</p>

<pre><code>this is a te
</code></pre>

<p>But i need it stop as a full word instead of splitting a word:</p>

<pre><code>this is a
</code></pre>

<p>How can I do that, remembering that <code>$sentence</code> isn't a fixed string (it could be anything)?</p>
