betweenAll

Returns an array of substrings between $start and $end.

Description

static[] betweenAll(string $start, string $end)

Parameters

  • string $start
    Delimiter marking the start of the substring.

  • string $end
    Delimiter marking the end of the substring.

Return Value

static[]

Examples

$expected = [['<p>Hello</p>', '<p>World</p>'], ['Hello', 'World']];
$str = new Str('<p>Hello</p><p>World</p>');
assert($str->betweenAll('<p>', '</p>') == $expected); // true

NOTE: The first array will be inclusive of $start & $end, the second array will not.