I am looking for a method with one or more php functions for manipulating form textarea data. I want to clean it up by indenting it and wrapping it after a certain length with EOL but not necessarily html <br> or <br /> before it is inserted in My database.

Or alternatively, I want to take a large block of text from the database and clean it up before populating it in a form textarea.

Can anyone offer which series of functions might satisfy these needs?