# RFC: grapheme_strrev: strrev for grapheme cluster

- Status: Implemented (PHP 8.6)
- Authors: Yuya Hamada youkidearitai@gmail.com
- Date: 2026-01-14
- Version: 0.9
- Implementation: https://github.com/php/php-src/pull/20949
- Original: https://wiki.php.net/rfc/grapheme_strrev
- Page: https://externals.io/rfc/grapheme_strrev
- 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

## Votes

### Add grapheme_strrev function (closed)

Yes: 20 · No: 0 · Abstain: 0

Voters: alexandredaubois (Yes), asgrim (Yes), ashnazg (Yes), bwoebi (Yes), crell (Yes), cschneid (Yes), daniels (Yes), derick (Yes), galvao (Yes), girgias (Yes), malferov (Yes), mbeccati (Yes), ocramius (Yes), pajoye (Yes), petk (Yes), ramsey (Yes), sergey (Yes), theodorejb (Yes), timwolla (Yes), weierophinney (Yes)

## Discussions on the mailing list

- [\[UNDER DISCUSSION\]\[RFC\] grapheme_strrev function](https://externals.io/message/129765.md) — started on 2026-01-16, 6 messages
- [\[VOTE\] grapheme_strrev: strrev for grapheme cluster](https://externals.io/message/130023.md) — started on 2026-02-06, 4 messages

---

## Introduction

This proposal is strrev for grapheme cluster unit function. Userland sometimes shows [mb\_strrev](https://github.com/search?q=mb_strrev&type=code) function, but mbstring(Unicode code point unit) can not support multi code point (for example, emoji etc...).

Almost same of Swift's [String.reversed()](https://developer.apple.com/documentation/swift/string/reversed()).

## Proposal

Add grapheme\_strrev function.

```php
<?php
echo grapheme_strrev("αあいうえお👨‍👨‍👧‍👦"); // result is "👨‍👨‍👧‍👦おえういあα"
echo grapheme_strrev("ﻡﺮﺤﺑًﺍ"); // result is "ﺍً ﺐﺣﺮﻣ" (Hello in Arabic, Also works RtoL languages)
?>
```

## Backward Incompatible Changes

This could break a function existing in userland with the same name.

## Proposed PHP Version(s)

Next of PHP 8.5 (PHP 8.6 or PHP 9.0)

## RFC Impact

### To the Ecosystem

None

### To Existing Extensions

Adds grapheme\_strrev() to the intl extension.

### To SAPIs

None

## Open Issues

None

## Future Scope

None

## Voting Choices

Pick a title that reflects the concrete choice people will vote on.

Please consult [the php/policies repository](https://github.com/php/policies/blob/main/feature-proposals.rst#voting-phase) for the current voting guidelines.

---

Primary Vote requiring a 2/3 majority to accept the RFC:

**Vote: Add grapheme\_strrev function** — Yes: 20 · No: 0 · Abstain: 0 (closed)

## Patches and Tests

- <https://github.com/php/php-src/pull/20949>

## Implementation

After the RFC 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

## References

- <https://news-web.php.net/php.internals/129765>
- <https://news-web.php.net/php.internals/130023>

## Rejected Features

Keep this updated with features that were discussed on the mail lists.

## Changelog

If there are major changes to the initial proposal, please include a short summary with a date or a link to the mailing list announcement here, as not everyone has access to the wikis' version history.
