[PHP] Re: limiting lines

2001-07-29 Thread James, Yz

Hiya Dan,

If you're expecting new lines, you could do this:

$length = explode(\n, $message);

if (sizeof($length)  55) {
// error
}

And also limit the number of characters, using strlen()

James

Dan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I would like to run a variable of unlimited length through a filter that
 would limit its length to 55 lines (ie limiting it's length to less than 1
 printed page).  Does anyone know of an easy way to do this?

 thanks.

 Regards,

 Dan Barber
 Mojolin

 ---
 Mojolin: The Open Source/Linux Employment Site
 http://www.mojolin.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: limiting lines

2001-07-29 Thread dan

Thanks for the quick answers. 

Problem is, the only new lines are at the end of paragraphs, so that, in
effect, is limiting them to 55 paragraphs.  I'm using a textarea
wrap=physical which says that it adds a %0A%0D (carriage return/line
feed) at the end of each line.  

Anyone know how to convert that to a \n ?

thanks again.

Dan
Mojolin: The Linux Employment Site
http://mojolin.com

 If you're expecting new lines, you could do this:
 
 $length = explode(\n, $message);
 
 if (sizeof($length)  55) {
 // error
 }
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]