|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-05 23:39 UTC] empaingeo at hotmail dot com
Description: ------------ --- From manual page: http://www.php.net/function.explode#refsect1-function.explode-returnvalues --- Hi, to reproduce the problem : Test script: --------------- <?php echo "<pre>"; echo print_r(explode(' ', " test1 test2")); echo "</pre>"; ?> Expected result: ---------------- Array ( [0] => test1 [1] => test2 ) 1 Actual result: -------------- Array ( [0] => [1] => [2] => [3] => [4] => test1 [5] => test2 ) 1 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 08:00:02 2025 UTC |
Totally intended and often desirable behavior. If you don't want those then trim() the spaces off first, or if you're worried about multiple spaces inside the string too ("test1 test2") then array_filter() the result.