#46574 [Opn->Bgs]: Literal backslashes before other backslashes should also be escaped

From: Date: Fri, 14 Nov 2008 15:10:10 +0000
Subject: #46574 [Opn->Bgs]: Literal backslashes before other backslashes should also be escaped
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1503@lists.php.net to get a copy of this message
ID: 46574 Updated by: sean@php.net Reported By: francois at bonzon dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: BPJZ PHP Version: Irrelevant New Comment: Duplicate of #44397 Previous Comments: ------------------------------------------------------------------------ [2008-11-14 13:06:44] francois at bonzon dot com Description: ------------ http://www.php.net/manual/en/language.types.string.php#language.types.st ring.syntax.single says: "To specify a literal backslash before a single quote, or at the end of the string, double it (\\)." This is incomplete, It should be added "before another backslash". Like this: "To specify a literal backslash before a single quote, before another backslash, or at the end of the string, double it (\\)." Reproduce code: --------------- To echo a literal single-quoted string containing only two backslash characters, I start by writing the enclosing quotes and the two backslashes themselves: echo '\\'; Then I should escape the second backslash, because it is "at the end of the string". It gives echo '\\\'; The first backslash, according the documentation, should not escaped, because it is neither before a single quote or at the end of the string. Expected result: ---------------- Two backslashes are echoed. Actual result: -------------- Parse error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46574&edit=1

« previous php.doc.bugs (#1503) next »