Re: Counting HTML Lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HTML doesn't do anything with long lines of text. But browsers will wrap the lines to fit within the confines of the page or table cell.

You can use the wordwrap function to break the string into lines (broken by \n) of a set number of characters. And then use ereg_replace to replace the \n's with <br>'s and then use substr_count to count how many <br>'s you have in the string.

Good luck,

Jeffrey Baumgartner


Ng Hwee Hwee wrote:

hi!

thanx for your reply. i cannot count the number of "\n" because sometimes
the inputted text is very long without any "\n", but because it is inside a
cell that has a linited width, HTML will automatically push it to the next
line, right? in this case, there won't be a count for "\n".

hwee

----- Original Message ----- From: "Petar Nedyalkov" <bu@xxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Friday, April 15, 2005 5:06 PM
Subject: Re: Counting HTML Lines


Count the "\n" characters in the output.




-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux