php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64303 str_word_count with format = 2
Submitted: 2013-02-26 13:13 UTC Modified: 2013-02-27 03:55 UTC
From: pierre at geobsd dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.4.12 OS: FreeBSD
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: pierre at geobsd dot com
New email:
PHP Version: OS:

 

 [2013-02-26 13:13 UTC] pierre at geobsd dot com
Description:
------------
---
From manual page: http://www.php.net/function.str-word-count#refsect1-function.str-word-count-parameters
---
$str = "Hello friend, you're
       looking good today!";

print_r(str_word_count($str, 2);

Thanks to the doc, "str_word_count" will return an associative array where the key is the numeric position of the word inside the string and the value is the actual word itself.

Yes, this function returns an associative array but the key is the numeric position of the First Letter of the word.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-27 03:55 UTC] frozenfire@php.net
The position of the first letter of a word, and the position of the word are 
identical values. Unless I'm misunderstanding you, this isn't a bug. It's just a 
different wording. In the context of this function's purpose, the wording of 
"position of the word" is appropriate.
 [2013-02-27 03:55 UTC] frozenfire@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC