unwrap

Removes a matching prefix and suffix from a string.

Usage

$string = '(abc)';
$string = SM::unwrap($string, '(', ')');
// or
$string = SM::make($string)
    ->unwrap('(', ')');

echo $string; // abc

Wrap omitting suffix

If the suffix is not provided, it defaults to the same value as the prefix.

$string = '"abc"';
$string = SM::unwrap($string, '"');
// or
$string = SM::make($string)
    ->unwrap('"');

echo $string; // abc

This site uses Just the Docs, a documentation theme for Jekyll.