search and replace in the output resulte of a php code
<p>I have made the following code in a PHP file to list the content of a directory
and it works just fine</p>

<pre><code>&lt;?php

  $dir = opendir(getcwd());
  while (($file = readdir($dir)) !== false) {
    echo "filename : ". $file ."&lt;br /&gt;";
  }
  closedir($dir);

?&gt;
</code></pre>

<p>I want to make some changes in the output (string) result. I have tried a search and replace PHP code <code>str_replace()</code> but I have been unable to get it to work.</p>
