formatQuotedString.php
Table of Contents
Functions
- formatQuotedString() : string
- Formats a string value with proper escaping and wrapping using the specified quote style.
Functions
formatQuotedString()
Formats a string value with proper escaping and wrapping using the specified quote style.
formatQuotedString(string $value[, string $quoteStyle = 'single' ][, bool $compact = false ]) : string
This function escapes necessary characters and wraps the string with either single or double quotes, depending on the provided style. Double-quoted strings will have common control characters escaped as well.
Parameters
- $value : string
-
The raw string to quote and escape.
- $quoteStyle : string = 'single'
-
The style of quoting to use: 'single' or 'double'. Default is 'single'.
- $compact : bool = false
Tags
Return values
string —The quoted and escaped string.