Replace the tag content without getting rid of any attributes : String Replace : String PHP Source Code


PHP Source Code » String » String Replace »

 

Replace the tag content without getting rid of any attributes




<?php
     $string = "<a href="http://www.navioo.com/">navioo.com</a><br />" ;
   
     $pattern = '/<a(.*?)>.*?</a>/i';
     $replacement = '<a1>Click!</a>';
   
     $string = preg_replace($pattern, $replacement, $string);
     print($string);
?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo String
» String Replace