php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47708 explode() with empty delimiter
Submitted: 2009-03-18 18:30 UTC Modified: 2012-01-07 04:38 UTC
Votes:6
Avg. Score:4.0 ± 1.4
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: david at grudl dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.0beta1 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

 [2009-03-18 18:30 UTC] david at grudl dot com
Description:
------------
Splitting a string into array of characters is not easy in PHP. It must be done using preg_split (slow) and with a lot of parameters:

$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);

Feature request: allow function explode() to split string into characters. Usage:

$chars = explode('', $str);

Rationale: there is counterpart function implode() which allows to use empty separator:

$str = explode('', $chars); // works


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-08 03:50 UTC] a at b dot c dot de
"It must be done using preg_split..."
....Or str_split().
 [2012-01-07 04:38 UTC] dtajchreber@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2012-01-07 04:38 UTC] dtajchreber@php.net
php.net/str_split
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC