|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50653 str_split sequence handling
Submitted: 2010-01-04 12:22 UTC Modified: 2010-12-20 15:53 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: robert_xp at gmx dot net Assigned:
Status: Open Package: Strings related
PHP Version: 5.3.1 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: robert_xp at gmx dot net
New email:
PHP Version: OS:


 [2010-01-04 12:22 UTC] robert_xp at gmx dot net
str_split is only able to split a string in periodical substrings. I think, it's a good improvement to allow arrays as a second parameter to handle sequences. I wrote a patch for that:

Reproduce code:
var_dump(str_split("0123456789abcdefwant to extract this?abcd", array(16, -4)));

var_dump(str_split("hello how are you?", array(0, 1, 6, 7, 9, -2, -1)));

Expected result:
array(3) {
  string(16) "0123456789abcdef"
  string(21) "want to extract this?"
  string(4) "abcd"
array(7) {
  string(1) "h"
  string(5) "ello "
  string(1) "h"
  string(2) "ow"
  string(7) " are yo"
  string(1) "u"
  string(1) "?"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-20 15:53 UTC]
-Package: Feature/Change Request +Package: Strings related
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 03:01:30 2024 UTC