public function bracketSpecialChars($value, bool $will_force_match_all = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->bracketSpecialChars($_value, $will_force_match_all);
            } // unset($_key, $_value); // Housekeeping.
            return $value;
        }
        if (!($string = (string) $value)) {
            return $string; // Empty.
        }
        if (!$will_force_match_all) {
            $string = preg_replace('/[*?[\]!{},\^$]/u', '[${0}]', $string);
        } else { // `^` and `$` are not special characters.
            $string = preg_replace('/[*?[\]!{},]/u', '[${0}]', $string);
        }
        return $string;
    }
public function bracketSpecialChars($value, bool $will_force_match_all = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->bracketSpecialChars($_value, $will_force_match_all);
            } // unset($_key, $_value); // Housekeeping.
            return $value;
        }
        if (!($string = (string) $value)) {
            return $string; // Empty.
        }
        if (!$will_force_match_all) {
            $string = preg_replace('/[*?[\]!{},\^$]/u', '[${0}]', $string);
        } else { // `^` and `$` are not special characters.
            $string = preg_replace('/[*?[\]!{},]/u', '[${0}]', $string);
        }
        return $string;
    }
public function bracketSpecialChars ( $ value , bool $ will_force_match_all = false ) { if ( is_array ( $ value ) || is_object ( $ value ) ) { foreach ( $ value as $ _key => & $ _value ) { $ _value = $ this -> bracketSpecialChars ( $ _value , $ will_force_match_all ) ; } // unset($_key, $_value); // Housekeeping. return $ value ; } if ( ! ( $ string = ( string ) $ value ) ) { return $ string ; // Empty. } if ( ! $ will_force_match_all ) { $ string = preg_replace ( '/[*?[\]!{},\^$]/u' , '[${0}]' , $ string ) ; } else { // `^` and `$` are not special characters. $ string = preg_replace ( '/[*?[\]!{},]/u' , '[${0}]' , $ string ) ; } return $ string ; }
Bracket special chars.

@since 170124.74961 New name. Old name `bracket()`.
@since 170124.74961 Adding `$will_force_match_all` param.

@param mixed $value                Input value(s) to bracket here.
@param bool  $will_force_match_all If true, don't treat `^$` as special chars.

@return string|array|object Bracketed value(s).
Bracket special chars .