Bug #71199 [Com]: PREG_SPLIT_NO_EMPTY gives wrong result

[email protected] ("inefedor at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71199&edit=1

 ID:                 71199
 Comment by:         inefedor at gmail dot com
 Reported by:        g dot statkute at gmail dot com
 Summary:            PREG_SPLIT_NO_EMPTY  gives wrong result
 Status:             Open
 Type:               Bug
 Package:            PCRE related
 Operating System:   Windows 7
 PHP Version:        5.5.30
 Block user comment: N
 Private report:     N

 New Comment:

The third parameter of preg_split is $limit. The right way to call it would be preg_split("/[;,\.]+/", $keyw, -1, PREG_SPLIT_NO_EMPTY)


Previous Comments:
------------------------------------------------------------------------
[2015-12-22 18:27:25] g dot statkute at gmail dot com

Description:
------------
---
From manual page: http://www.php.net/function.preg-split
---


Test script:
---------------
   $keyw=" some, string,,, separaed by many ... different ; ; ;separators";
        $searchArr = preg_split( "/[;,\.]+/", $keyw ,PREG_SPLIT_NO_EMPTY  ); 
        print_r($searchArr);

gives: Array ( [0] => some, string,,, separated by many ... different ; ; ;separators ) 



Expected result:
----------------
Array ( [0] => some [1] => string [2] => separated by many [3] => different [4] =>  separators ) 

Actual result:
--------------
Array ( [0] => some, string,,, separated by many ... different ; ; ;separators )


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71199&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.