betweenBrackets.php
Table of Contents
Functions
- betweenBrackets() : string
- Encapsulates an expression between brackets '[..]'
Functions
betweenBrackets()
Encapsulates an expression between brackets '[..]'
betweenBrackets([mixed $expression = '' ][, bool $useBrackets = true ][, string $separator = ' ' ][, bool $trim = true ]) : string
- If the expression is a string, it is wrapped in brackets.
- If the expression is an array, its values are concatenated with the given separator, then wrapped in brackets.
- If
$useParentheses
is false, the expression is returned without wrapping.
Parameters
- $expression : mixed = ''
-
The expression to wrap.
- $useBrackets : bool = true
-
Whether to apply the brackets.
- $separator : string = ' '
-
Separator for arrays.
- $trim : bool = true
-
Whether to trim existing
$left
/$right
characters (default: true).
Tags
Return values
string —The wrapped expression.