how to replace string in php?
<p>I am trying to get the first 10 charaters of the string and want to replace space with <code>'_'</code>.</p>

<p>I have</p>

<pre><code>  $text=substr($text,0,10);
  $text=  strtolower($text);
</code></pre>

<p>but I am not sure what to do next.</p>

<p>I want the string</p>

<pre><code>this is the test for string.
</code></pre>

<p>become</p>

<pre><code>this_is_th
</code></pre>

<p>Thanks for help!</p>
