Oihana PHP

betweenDoubleQuotes.php

Table of Contents

Functions

betweenDoubleQuotes()  : string
Wraps an expression in double quotes or a custom character.

Functions

betweenDoubleQuotes()

Wraps an expression in double quotes or a custom character.

betweenDoubleQuotes([mixed $expression = '' ][, string $char = '"' ][, bool $useQuotes = true ][, string $separator = ' ' ][, bool $trim = true ]) : string
  • Strings are wrapped directly.
  • Arrays are concatenated with the given separator, then wrapped.
  • Wrapping can be disabled with the $useQuotes flag.
Parameters
$expression : mixed = ''

The value to wrap (string, array, or any type convertible to string).

$char : string = '"'

The quote or character to wrap around the expression (default: single quote ').

$useQuotes : bool = true

Whether to wrap the expression (default: true).

$separator : string = ' '

Separator used to join array elements (default: ' ').

$trim : bool = true

Whether to trim existing $left/$right characters (default: true).

Tags
example
betweenQuotes('world');        // returns "world"
betweenQuotes(['foo', 'bar']); // returns "foo bar"
since
1.0.6
author

Marc Alcaraz

Return values
string

The resulting wrapped expression.


        
On this page

Search results