I'm going to assume you meant "before every star", as that's what your example looks like.
Originally Posted by shajiuddin
Try using all single quotes or all double quotes in your code's function. Not sure if that would make a difference, but helps to be consistent.
That said, your fuction does look correct if you are trying to add line breaks to, say, a file or a text document. If you are trying to get line breaks on a webpage, then you don't use \r\n, you use <br>... which would make the function look like this:
$b = str_replace('*',"<br>*",'* aaaa * bbbb * cccc');