#35427 [Bgs-Opn]: str_word_count handles() '-' incorrectly
ID: 35427 User updated by: tomas_matousek at hotmail dot com Reported By: tomas_matousek at hotmail dot com -Status: Bogus +Status: Open Bug Type: Strings related Operating System: * PHP Version: 5.1.0 New Comment: Read again the full doc! Don't stop at the middle. RTFM: charlist A list of additional characters which will be considered as 'word' Previous Comments: [2005-11-28 01:04:24] [EMAIL PROTECTED] RTFM: For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with ' and - characters. [2005-11-27 20:00:54] tomas_matousek at hotmail dot com By passing 0 as the third parameter, one declares '0' character legal word character which should be equivalent to any other letter, e.g. 'x'. bar-xbar is considered to be a word so bar-0bar should be word as well. [2005-11-27 19:28:44] [EMAIL PROTECTED] bar-0var doesn't look like a valid *WORD* to me. Or is it? [2005-11-27 19:12:17] tomas_matousek at hotmail dot com Description: Characters specified in str_word_count() should be treated equally to letters, right? This works for apostrophe but doesn't for hyphen. Reproduce code: --- var_dump(str_word_count(foo'0 bar-0var, 2, 0)); Expected result: array(3) { [0]= string(5) foo'0 [6]= string(3) bar0var } Actual result: -- array(3) { [0]= string(5) foo'0 [6]= string(3) bar [10]= string(4) 0var } -- Edit this bug report at http://bugs.php.net/?id=35427edit=1
#35427 [Bgs-Opn]: str_word_count handles() '-' incorrectly
ID: 35427 User updated by: tomas_matousek at hotmail dot com Reported By: tomas_matousek at hotmail dot com -Status: Bogus +Status: Open Bug Type: Strings related Operating System: * PHP Version: 5.1.0 New Comment: No, I needn't. str_word_count(bar-var) returns 1, so '-' is considered as a part of the word if it is followed by 'word' character. See the source code. The bug is clear there. Previous Comments: [2005-11-28 09:47:30] [EMAIL PROTECTED] Yes, you need to add the - in the list. [2005-11-28 09:29:10] tomas_matousek at hotmail dot com Read again the full doc! Don't stop at the middle. RTFM: charlist A list of additional characters which will be considered as 'word' [2005-11-28 01:04:24] [EMAIL PROTECTED] RTFM: For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with ' and - characters. [2005-11-27 20:00:54] tomas_matousek at hotmail dot com By passing 0 as the third parameter, one declares '0' character legal word character which should be equivalent to any other letter, e.g. 'x'. bar-xbar is considered to be a word so bar-0bar should be word as well. [2005-11-27 19:28:44] [EMAIL PROTECTED] bar-0var doesn't look like a valid *WORD* to me. Or is it? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/35427 -- Edit this bug report at http://bugs.php.net/?id=35427edit=1