I have some variable like this;

```
<?php the_field('reviews'); ?>

```

This variable prints;

```
Some text 1
Some text 2
Some text 3
Some text 4

```

source code is here:

[![](https://i.stack.imgur.com/9vm5Q.jpg)](https://i.stack.imgur.com/9vm5Q.jpg)

and look like this

[![](https://i.stack.imgur.com/vj98f.jpg)](https://i.stack.imgur.com/vj98f.jpg)

Now, i want to convert **br** tag to **hr** like this

[![enter image description here](https://i.stack.imgur.com/OLgCz.jpg)](https://i.stack.imgur.com/OLgCz.jpg)

I tried the following ***[nospor](https://stackoverflow.com/users/6356056/nospor)***'s codes but not worked.

```
$change = the_field('reviews');
$change = str_replace(array('<br>', '</br>'), array('', '<hr>'), $change);
echo $change;

```

How can i change that **br** tags to **hr** tag with PHP?
['https://Stackoverflow.com/questions/37563013', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2745938/']
`<br> </br>` is incorrect.

**HTML** `<br>` is an empty tag,so there is no end tag.

**XHTML** `<br />`

then you can use function `str_replace` to relace "br" by "hr" 

```
$tag_br = array(
  "<br>",
  "</br>"
);
$tag_hr = array(
  "<hr>",
  ""
);
$change = str_replace($tag_br,$tag_hr ,$change);

```
[Above answer](https://stackoverflow.com/a/37563100/3536236) is exactly correct.

You should use `str_replace`

the different between `str_replace` and `preg_replace` 

```
$string = "foo fighters";
$str_replace = str_replace('foo','bar',$string);
$preg_replace = preg_replace('/f.{2}/','bar',$string);
echo 'str_replace: ' . $str_replace . ', preg_replace: ' . $preg_replace;

```

the output will be:

```
str_replace: bar fighters, preg_replace: bar barhters

```