Bug #71199 [Opn->Nab]: PREG_SPLIT_NO_EMPTY gives wrong result

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

 ID:                 71199
 Updated by:         [email protected]
 Reported by:        g dot statkute at gmail dot com
 Summary:            PREG_SPLIT_NO_EMPTY  gives wrong result
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            PCRE related
 Operating System:   Windows 7
 PHP Version:        5.5.30
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

https://3v4l.org/5jAkV


Previous Comments:
------------------------------------------------------------------------
[2015-12-22 18:50:03] inefedor at gmail dot com

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

------------------------------------------------------------------------
[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.