note 41080 deleted from function.split by irchtml

From: Date: Sat, 12 Jun 2004 21:41:53 +0000
Subject: note 41080 deleted from function.split by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70991@lists.php.net to get a copy of this message
Note Submitter: Tim ---- I created the following to parse my user input... Let's say someone adds a comment to my comment system... I want them to be able to have some newlines, but they could be mallicious and try and throw like 40 newlines in there... That could look real ugly... This way I can set a maximum of newlines a user can enter. :) <?php $MaxNewLines = 5; $Message = str_replace(chr(13), "<br />", $Message); $MessageArray = split("<br />", $Message, $MaxNewLines); $Message = ""; $u=0; do { $Message.=$MessageArray[$u].'<br />'; $u++; } while($u<($MaxNewLines-1)); $Message.=str_replace("<br />"," ",$MessageArray[$u]); ?> -Tim http://www.alphibia.com

« previous php.notes (#70991) next »