Req #52268 [Com]: explode with an Array as Delimiter

From: Date: Sat, 10 Jul 2010 23:17:22 +0000
Subject: Req #52268 [Com]: explode with an Array as Delimiter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152261@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52268&edit=1 ID: 52268 Comment by: jinmoku at hotmail dot com Reported by: halloanjedendenichkenne at gmail dot com Summary: explode with an Array as Delimiter Status: Open Type: Feature/Change Request Package: Unknown/Other Function Operating System: Irrelevant PHP Version: Irrelevant New Comment: use preg_split instead ;) var_dump(preg_split('/[, !\.]/', 'Hello, World! This is a Test!')); Previous Comments: ------------------------------------------------------------------------ [2010-07-06 20:28:38] halloanjedendenichkenne at gmail dot com Description: ------------ It would be useful if you were able to pass an Array as Delimiter to explode. The "Test Script" contains an Example. Test script: --------------- <?php var_dump(explode(array(',', '.', '!', ' '), 'Hello, World! This is a Test!')); /* Should output something like: array(8) { [0]=> string(5) "Hello" [1]=> string(0) "" [2]=> string(5) "World" [3]=> string(0) "" [4]=> string(4) "This" [5]=> string(2) "is" [6]=> string(1) "a" [7]=> string(4) "Test" } */ ?> Expected result: ---------------- Included in the Test Script Actual result: -------------- Warning: explode() expects parameter 1 to be string, array given in php shell code on line 1 NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52268&edit=1

« previous php.bugs (#152261) next »