escapeTomlString.php
Table of Contents
Functions
- escapeTomlString() : string
- Escapes a value so it can be embedded in a TOML basic string.
Functions
escapeTomlString()
Escapes a value so it can be embedded in a TOML basic string.
escapeTomlString(string $value) : string
The returned value does not include the surrounding quotes. Backslashes and double
quotes are escaped, and the control characters TOML forbids in a basic string are written
as escape sequences: the ones with a shorthand (\b, \t, \n, \f, \r) use it, the
others and DEL become \uXXXX.
Without this, a value holding a quote or a backslash — a password, typically — produces a document the TOML parser rejects, and the whole file becomes unreadable.
Parameters
- $value : string
-
The raw value to escape.
Tags
Return values
string —The escaped value, ready to be wrapped in double quotes.