Monday, May 4, 2015

Delete all between string From and TO

function delete_all_between($beginning, $end, $string)
    {
        $beginningPos = strpos($string, $beginning);
        $endPos = strpos($string, $end);
        if ($beginningPos === false || $endPos === false)
        {
            return $string;
        }

        $textToDelete = substr($string, $beginningPos, ($endPos + strlen($end)) - $beginningPos);

        return str_replace($textToDelete, '', $string);
    }

No comments:

Nathuram Godse - The Man Who Killed Gandhi

Nathuram Godse - The Man Who Killed Gandhi (The Other Side of The Story)