# \[PHP\] Trim Function Alternative

**URL:** <https://forum.kirupa.com/t/php-trim-function-alternative/205500>\
**Category:** programming\
**Created:** [October 30, 2006, 10:32am UTC](https://forum.kirupa.com/t/php-trim-function-alternative/205500 "2006-10-30T10:32:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thesleuth](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thesleuth](https://forum.kirupa.com/u/thesleuth)\
**Post date:** [October 30, 2006, 10:32am UTC](https://forum.kirupa.com/t/php-trim-function-alternative/205500/1 "2006-10-30T10:32:40Z")

</div>

Hi,  
I’m storing a message in a database. I want to prevent the database from saving spaces or lines that are created by users when they hit enter. I’ve tried the trim function but it does not work. Any suggestion would be helpful. Thanks in advance 🙂
