Sub-string without counting blank spaces
<p>I want to make a sub-string, where the <code>$count</code> only counts letters, not spaces.  This is what I have so far:</p>

<pre><code>$string ="vikas tyagi php";
$string = substr($string, 0, 10);
echo $string;
</code></pre>

<p>Output:</p>

<pre><code>vikas tyag
</code></pre>

<p>Desired output (I don't want to count the spaces):</p>

<pre><code>vikas tyagi
</code></pre>

<p>How would I do this?</p>

<p>i want extract string with those condition</p>

<p>1)Base on count letter </p>

<p>2)Without white space </p>

<p>3)String limit also</p>
