fork download
  1. <?php
  2.  
  3. $pattern = '/Canção/';
  4. $replacement = "<b>Test</b>";
  5. $string = html_entity_decode("<p>Canção Can&ccedil;ão Can&ccedil;ão</p>");
  6.  
  7. $new_string = "";
  8.  
  9. $new_string = preg_replace($pattern, $replacement, $string);
  10.  
  11. echo $new_string;
Success #stdin #stdout 0.02s 24144KB
stdin
Standard input is empty
stdout
<p><b>Test</b> <b>Test</b> <b>Test</b></p>