Edit report at https://bugs.php.net/bug.php?id=65396&edit=1
ID: 65396 User updated by: empaingeo at hotmail dot com Reported by: empaingeo at hotmail dot com Summary: Separators at the beginning of string are also exploded Status: Open Type: Bug Package: Strings related Operating System: Windows Vista PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Hi, thanks for the reply. I will follow your advice. Best regards. Previous Comments: ------------------------------------------------------------------------ [2013-08-07 20:36:54] mail+php at requinix dot net 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. ------------------------------------------------------------------------ [2013-08-05 23:39:25] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65396&edit=1