note 112958 deleted from function.preg-split by cmb
| From: | cmb@php.net | Date: | Tue, 23 Aug 2016 13:35:07 +0000 |
| Subject: | note 112958 deleted from function.preg-split by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206377@lists.php.net to get a copy of this message | ||
Note Submitter: anton at zebooka dot com
----
A not good code in example regexp.
It should be written
preg_split("/[\\s,]+", ...
because there is no special symbol \s (like \n for example) and we need to pass exactly \s, not
symbol that \s may represent.
So we need to escape backslash with backslash
$a = "/[\\s,+]/";
echo $a;
php> /[\s,+]/