# Solved: PHP - Strip tags but turn <br /> into ,



## amanxman (Mar 28, 2006)

Hey,

I have a php field which outputs are:

Address
Address 1 
Address 2
City

for example.

I want, in one instance, for this to output as:

Address, Address 1, Address 2, City.

I.e. replacing the 
s with commas.

I can strip out the html tags using strip_tags, but this will just give me:

AddressAddress1Address2 - i.e. no commas and spaces.

Is this at all possible (easily)?

Cheers


----------



## MMJ (Oct 15, 2006)

```
<?php str_replace('
', ',', 'Address
Address 1 
Address 2
City'); ?>
```
or you can use explode.


----------



## amanxman (Mar 28, 2006)

Sweet, thanks!


----------



## Big-K (Nov 22, 2003)

Really, you would want to put a strip_tags() around the str_replace() if you want to get rid of any html in the string.


----------

