Re: [PHP] word count on record insertion

2004-06-25 Thread Geethanandh Kandasamy
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

Re: [PHP] word count on record insertion

2004-06-25 Thread Matt M.
> 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

[PHP] word count on record insertion

2004-06-25 Thread Chris
Hi There, I'm trying to develop a band listing site and was just wondering if there is a php function that could limit the amount of words added into a text area. I'm aware that this can be done in javascript but the only one I found doesn't work properly if you try and paste in text to the text b

Re: [PHP] Word Count

2003-01-25 Thread George E. Papadakis
$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

Re: [PHP] Word Count

2003-01-24 Thread Craig
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

Re: [PHP] Word Count

2003-01-23 Thread Maxim Maletsky
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

Re: [PHP] Word Count

2003-01-23 Thread Steve Edberg
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

Re: [PHP] Word Count

2003-01-23 Thread Adam Voigt
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.

Re: [PHP] Word Count

2003-01-23 Thread Chris Boget
> 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:/

[PHP] Word Count

2003-01-23 Thread Craig
Is there a way to count the number of words in a string? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Word Count function?

2002-06-24 Thread Andre Dubuc
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

Re: [PHP] Word Count function?

2002-06-24 Thread Analysis & Solutions
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

[PHP] Word Count function?

2002-06-24 Thread Andre Dubuc
Is there a function that counts the number of words in a string? I checked through the manual and archives using 'word count', and found nothing. I suppose it is possible to generate code that will accomplish this, using 'space' as the delimiting separator. But before I re-invent the wheel .