Re: Implode() FR and Patch
| From: | Lars Strojny | Date: | Sat, 06 Dec 2008 23:07:46 +0000 |
| Subject: | Re: Implode() FR and Patch | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42129@lists.php.net to get a copy of this message | ||
Hi Igor,
thanks for the patch, I think it is an idea worth considering. Except
that the proposed solution with executing array_filter() might be
enough. You ran into a situation where this became a bottleneck in your
code?
Am Samstag, den 06.12.2008, 00:21 -0200 schrieb Igor Feghali:
> Hello There,
>
> I would like to propose a third argument to implode(), named
> skip_empty, that will cause empty elements to be ignored when
> generating the implode string. By empty I mean everything that
> converts to an empty string such as '', false, null, etc.
For consistency, if we decide to introduce that for implode(), we should
do it for explode() too.
php -r "var_dump(explode(',', 'foo,,bla'));"
array(3) {
[0]=>
string(3) "foo"
[1]=>
string(0) ""
[2]=>
string(3) "bla"
}
and
php -r "var_dump(explode(',', 'foo,,bla', true));"
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bla"
}
Anyway, would you mind writing a proper RFC for the addition?
cu, Lars
--
Jabber: lars@strojny.net
Weblog: http://usrportage.de
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc