Back flip + number interpreted by PHP as an octal value, how to block it?

I need to reformat a string that may contain the following:

$string = "---8\7----";

The problem is that "\ 7" is interpreted by PHP as an octal value, not just "\" and then "7".

How can I block php from doing this? Of course I need to save '\' Thanks.

+3
source share
5 answers

, , , , . , PHP , , . , ;

$string = '---8\7----';

pro con , , , , .:)

+7

.

$string = "---8\\7----";
+1

Remove the backslash.

$string = "---8\\7----";
0
source

Use two features:

$string = "---8\\7----";
0
source

Use escape char:

$string = "---8\\7----";
0
source

All Articles