<?php var_dump(remove_last('bla test bla test bla test bla test bla', 'test', ' ')); function remove_last(string $text, string $subject, string $separator): string { if (($offset = strrpos($text, "$separator$subject")) === false) { $offset = strrpos($text, "$subject$separate"); } if ($offset !== false) { return substr_replace($text, '', $offset, strlen("$separator$subject")); } return $text; }
You have javascript disabled. You will not be able to edit any code.