remove_substr_between()

function remove_substr_between(string $start, string $end, string $haystack, bool $remove_all = false): string

Description

Removes a portion of a string between two given substrings. Optionally, all matching portions can be removed rather than just the first occurrence.

Parameters

Parameter Type Description Default
$start string The starting substring marking where removal begins. N/A
$end string The ending substring marking where removal ends. N/A
$haystack string The string from which to remove the substring. N/A
$remove_all bool Whether to remove all matching portions. If false, only the first occurrence is removed. false

Return Value

Type Description
string The modified string with the specified section(s) removed.

Example Usage