# RFC: Implement strrstr for consistency

- Status: Withdrawn
- Authors: George Peter Banyard girgias@php.net
- Date: 2019-06-20
- Version: 0.9
- Original: https://wiki.php.net/rfc/implement-strrstr-for-consistency
- Page: https://externals.io/rfc/implement-strrstr-for-consistency
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Discussions on the mailing list

- [\[RFC\] Implement strrstr counterpart to strstr for consistency](https://externals.io/message/105997.md) — started on 2019-06-20, 3 messages

---

## Introduction

Implement `strrstr` (and possibly `strristr`) for consistency with the `strpos` string functions family.

Currently there exist no “proper” counter part to the `strstr` (and `stristr`) standard string function. There exist `strrchr` however it does not have the same signature as `strstr` nor `strchr` as `strchr` is an alias of `strstr`, nor does it provide the same features.

## Proposal

Implement `strrstr` and `strristr` (?) in PHP 7.4 with the same features as `strstr`, meaning that the `$needle` parameter can accept multiple characters and add a boolean parameter `$before_needle` which has a default value of `false`.

## Pros

- Consistency within the standard library
- Feature built-in to the language

## Cons

- More “bloat” in the global namespace
- Follows an old naming scheme
- Adds a function alias to the language
- Easily implemented in userland

## Backward Incompatible Changes

None

## Proposed PHP Version(s)

Next minor i.e. PHP 7.4.

## Open Issues

How to handle the newly created alias.

## Proposed Voting Choices

2/3 Majority for adding `strrstr` (and possibly `strristr` after discussion).

## Patches and Tests

GitHub PR [\#4064](https://github.com/php/php-src/pull/4064)

## Implementation

After the project is implemented, this section should contain

1. the version(s) it was merged into
2. a link to the git commit(s)
3. a link to the PHP manual entry for the feature
4. a link to the language specification section (if any)

## References

Announcement on internals: <https://externals.io/message/105997>
