3v4l.org

run code in 500+ PHP versions simultaneously
<?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; }

preferences:
94.53 ms | 1401 KiB | 5 Q