nl2br, new line to br

I just forget this function when my friend ask me about strangeness in his data he store in mysql.

He has address data in <textarea></textarea>, new line not converted to br as he thing. He just see all the input just store in single line.

After search for a while I remember this gold function :

nl2br () , new line to br

just make temporary variable before as :

$address=nl2br($address);

now $address will contain <br> tag in mysql database.

This post for remind me in future 😉

 

Tags: