Re: Counting HTML Lines
| From: | Jeffrey | Date: | Fri, 15 Apr 2005 09:39:09 +0000 |
| Subject: | Re: Counting HTML Lines | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39198@lists.php.net to get a copy of this message | ||
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@orbitel.bg> To: <php-db@lists.php.net> Sent: Friday, April 15, 2005 5:06 PM Subject: Re: [PHP-DB] Counting HTML Lines Count the "\n" characters in the output.