#47708 [Com]: explode() with empty delimiter

From: Date: Mon, 08 Jun 2009 03:50:41 +0000
Subject: #47708 [Com]: explode() with empty delimiter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138086@lists.php.net to get a copy of this message
ID: 47708 Comment by: a at b dot c dot de Reported By: david at grudl dot com Status: Open Bug Type: Feature/Change Request PHP Version: 5.3.0beta1 New Comment: "It must be done using preg_split..." ....Or str_split(). Previous Comments: ------------------------------------------------------------------------ [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 http://bugs.php.net/?id=47708&edit=1

« previous php.bugs (#138086) next »