Did you try calling the word counter function in the onChange event of
textbox and truncate the characters/words
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
> I want to have something similar to this but as mentioned above want
> something more reliable so does anyone know a php function to do this or
> have a better option?
http://us3.php.net/manual/en/function.str-word-count.php, also some
good suggestions in the user comments
--
PHP General Maili
$wordsCount = str_word_count($string);
-- georgep
- Original Message -
From: "Maxim Maletsky" <[EMAIL PROTECTED]>
To: "Craig" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 11:26 PM
Subject: Re: [PHP] Word Count
&g
Using these methods, could you use it to insert additional text before and
after the first word (or the nth word)
e.g.
$text = "This is my text, for placement";
$textWithAddedString = "(word1 start)This(word1 end) is my text, for
placement";
"Maxim Maletsky" <[EMAIL PROTECTED]> wrote in messag
words, for a programming language, are nothing more than just the spaces.
So, as previousely was shown - could the mount of spaces in the string
to get the amount of `words' in between them.
--
Maxim Maletsky
[EMAIL PROTECTED]
"Craig" <[EMAIL PROTECTED]> wrote... :
> Is there a way to count t
To be somewhat more rigorous, you could do:
$numOfWords = count(preg_split('/\s+/', trim($string)));
(also untested); this ignores leading/trailing whitespace, and deals
with multiple spaces/tabs between words. There is an example in the
docs (below) called 'Get the parts of a search string' t
Umm, how about:
$string = "hi my name is bob";
$count = (substr_count($string," ")+1);
On Thu, 2003-01-23 at 11:35, Craig wrote:
Is there a way to count the number of words in a string?
--
PHP General Mailing List (http://www.php.
> Is there a way to count the number of words in a string?
Untested, but this should work.
$string = "Is there a way to count the number of words in a string?"
$numOfWords = count( explode( " ", $string ));
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http:/
Thanks Dan,
Does the job neatly!
Regards,
Andre
On Monday 24 June 2002 06:01 pm, you wrote:
> Andre:
>
> On Mon, Jun 24, 2002 at 05:29:16PM -0400, Andre Dubuc wrote:
> > Is there a function that counts the number of words in a string?
>
> I don't recall there being one. But, you could do this
Andre:
On Mon, Jun 24, 2002 at 05:29:16PM -0400, Andre Dubuc wrote:
> Is there a function that counts the number of words in a string?
I don't recall there being one. But, you could do this:
$array = preg_split('/\s+/', $string);
echo count($array);
Enjoy,
--Dan
--
PHP clas
10 matches
Mail list logo