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 -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -