|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2023 The PHP Group
All rights reserved.
Last updated: Sat Apr 01 07:03:36 2023 UTC