Quantcast
Channel: Gupta's Galaxy..
Viewing all articles
Browse latest Browse all 10

Removing new line \n from string..

$
0
0

Sometimes the invisible new line character breaks the code, specially when we are using some javascript. I had a recent experience when using wz_tooltip extension to create good tooltips and I realized that the newline character [\n] breaks the tooltip widget.

You can easily remove these and replace them with <br> by following code..

1
2
$subject = nl2br($targetstring);
$newstring = preg_replace("/[\n\r]/","",$subject);


Viewing all articles
Browse latest Browse all 10

Trending Articles