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

From: Date: Wed, 23 Dec 2015 01:30:11 +0000
Subject: Bug #71199 [Opn->Nab]: PREG_SPLIT_NO_EMPTY gives wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198157@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71199&edit=1 ID: 71199 Updated by: requinix@php.net 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

« previous php.bugs (#198157) next »