php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42207 str_word_count() considers "-" single character as a word
Submitted: 2007-08-04 13:30 UTC Modified: 2007-08-04 14:00 UTC
From: marcelrcavalcante at yahoo dot com dot br Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.4RC1 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marcelrcavalcante at yahoo dot com dot br
New email:
PHP Version: OS:

 

 [2007-08-04 13:30 UTC] marcelrcavalcante at yahoo dot com dot br
Description:
------------
str_word_count() considers "-" single character as a word. Either the itens "--", "---", "----" ...

Reproduce code:
---------------
$words = str_word_count("aaa - bbb-bb -- -ccc ---", 2);
print_r($words);

Expected result:
----------------
Array
(
    [0] => aaa
    [6] => bbb-bb
    [16] => -ccc
)

Actual result:
--------------
Array
(
    [0] => aaa
    [4] => -
    [6] => bbb-bb
    [13] => --
    [16] => -ccc
    [21] => --
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-04 14:00 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 22:01:32 2024 UTC