php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50985 Backslash not escaped in example while using double qoutes.
Submitted: 2010-02-10 02:44 UTC Modified: 2010-02-10 10:17 UTC
From: j at sights dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2010-02-10 02:44 UTC] j at sights dot de
Description:
------------
pattern in example #1 is "/[\s,]+/"... but should be single-quoted or the \ needs to be escaped.

Reproduce code:
---------------
---
From manual page: function.preg-split#Beispiele
---



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-10 10:17 UTC] degeberg@php.net
Thank you for the report. The \s is not a valid escape sequence in PHP so there is no need for escaping the backslash nor switching to single quotes. You only need to escape a backslash if it would otherwise be regarded as part of an escape sequence, e.g. \\n vs. \n. You can see a list of the escape sequences here: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 18:01:36 2024 UTC