Getting substring of a string from different aspects
<p>I need to get substring from a string where it will give output of first 25 characters from different aspects. Here substring should only consider commas (,) not spaces.</p>

<p><em>Scenario 1:</em></p>

<pre><code>$str = "the, quick, brown, fox";

$res = "the, quick, brown, fox";
</code></pre>

<p><em>Scenario 2:</em></p>

<pre><code>$str = "the, quick, brown, fox, jumps, over, the, lazy, dog!";

$res = "the, quick, brown, fox, more";
</code></pre>

<p><em>Scenario 3:</em></p>

<pre><code>$str = "the quick, brown fox, jumps over, the lazy dog!";

$res = "the quick, brown fox, more";
</code></pre>

<p><em>Scenario 4:</em></p>

<pre><code>$str = "the quick brown fox, jumps over, the lazy dog!";

$res = "the quick brown fox, more";
</code></pre>

<p>Please help! Thanks. </p>

<p><em>Extremely sorry for my English!</em></p>
