Php substr entire words
<p>How can i substr 20 chars from $xbio and get only complete words?</p>

<pre><code>$xbio = 'word1 ord2 word3 word4 and so on';
echo ''.substr($xbio, 0, 20).'...';
</code></pre>

<p>TY</p>

<p>Found this searching stackoverflow - tell me what do you think please:</p>

<pre><code>&lt;? $xbio = preg_replace('/\s+?(\S+)?$/', '', substr($xbio, 0, 50)); ?&gt;
</code></pre>
