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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: j at sights dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 22:00:01 2026 UTC