Req #47708 [Opn->Bgs]: explode() with empty delimiter
| From: | dtajchreber@php.net | Date: | Sat, 07 Jan 2012 04:38:02 +0000 |
| Subject: | Req #47708 [Opn->Bgs]: explode() with empty delimiter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166276@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=47708&edit=1
ID: 47708
Updated by: dtajchreber@php.net
Reported by: david at grudl dot com
Summary: explode() with empty delimiter
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
PHP Version: 5.3.0beta1
Block user comment: N
Private report: N
New Comment:
php.net/str_split
Previous Comments:
------------------------------------------------------------------------
[2009-06-08 03:50:41] a at b dot c dot de
"It must be done using preg_split..."
....Or str_split().
------------------------------------------------------------------------
[2009-03-18 18:30:00] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=47708&edit=1