Replace strings in php -


i have string consists of tags <p> </p> , want replace them <br />, whenever try using str_replace() not so.

is there solution it? other possible way it?

   $string="<p> 1 para </p> <p> second </p>"; 

using:

   str_replace("</p> <p>","<br />",$string> nothing gets replaced. 

are looking this?

 <?php      $string = "<p> 1 para </p> <p> second </p>";      $searcharray = array(         '<p>'       , '</p>'     );      $replacearray = array(         ''       , '<br />'     );      var_dump( str_replace($searcharray, $replacearray, $string) );  ?> 

output

string(47) " 1 para <br />  second <br />" 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -