|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-12-22 18:27 UTC] 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 ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 13:00:01 2025 UTC |
The third parameter of preg_split is $limit. The right way to call it would be preg_split("/[;,\.]+/", $keyw, -1, PREG_SPLIT_NO_EMPTY)