public function doubleQuote($value, bool $for_csv = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->doubleQuote($_value);
            } // unset($_key, $_value);
            return $value;
        }
        return '"'.str_replace('"', $for_csv ? '""' : '\\"', (string) $value).'"';
    }
public function doubleQuote($value, bool $for_csv = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->doubleQuote($_value);
            } // unset($_key, $_value);
            return $value;
        }
        return '"'.str_replace('"', $for_csv ? '""' : '\\"', (string) $value).'"';
    }
public function doubleQuote ( $ value , bool $ for_csv = false ) { if ( is_array ( $ value ) || is_object ( $ value ) ) { foreach ( $ value as $ _key => & $ _value ) { $ _value = $ this -> doubleQuote ( $ _value ) ; } // unset($_key, $_value); return $ value ; } return '"' . str_replace ( '"' , $ for_csv ? '""' : '\\"' , ( string ) $ value ) . '"' ; }
Double-quote encapsulation.

@since 160708 Quotes.

@param mixed $value   Input value.
@param bool  $for_csv Changes quote-style for CSV compat.
CSV quoting requires the use of a double-quote as the escape char.

@return string|array|object Output value.

@WARNING Double-quotes, in most languages, result in evaluation.
Double - quote encapsulation .