title: preg_replace to preg_replace_calback using array
body: <p>I'd to change the preg_replace code to <code>preg_replace_callback.</code> 
  <strong>preg_replace code</strong></p>
  
  <pre><code>function replaceChars($text) {
  // $text should contain an HTML document/content.
  // This will remove HTML tags, javascript sections
  // and white space. It will also convert some
  // common HTML entities to their text equivalent.
  
  $search = array ("'&amp;(quot|#34);'i",  
                   "'&amp;(amp|#38);'i",
                   "'&amp;(lt|#60);'i",
                   "'&amp;(gt|#62);'i",
                   "'&amp;(nbsp|#160);'i",
                   "'&amp;(iexcl|#161);'i",
                   "'&amp;(cent|#162);'i",
                   "'&amp;(pound|#163);'i",
                   "'&amp;(copy|#169);'i",
                   "'&amp;#(\d+);'e"); 
  
  $replace = array ("\"",
                    "&amp;",
                    "&lt;",
                    "&gt;",
                    " ",
                    chr(161),
                    chr(162),
                    chr(163),
                    chr(169),
                    "chr(\\1)");
  
  $text = preg_replace ($search, $replace, $text);
  $text = html_entity_decode ( $text , ENT_QUOTES , 'UTF-8' );
  return $text;
  }
  </code></pre>
  
  <p><strong>preg_replace_callback code</strong></p>
  
  <pre><code>return preg_replace_callback (  ($search) , function ($matches) use ($replace) {
          return ( ( isset ( $replace[$matches[1]] ) ) ? $replace[$matches[1]] : '' );
      } , $text );
  </code></pre>
  
  <p>I'm getting the warning Modifier /e cannot be used with replacement callback in line no.</p>