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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 06:01:36 2025 UTC