Skip to content

[RFC] Add grapheme_strrev function php 8.6#578

Merged
nicolas-grekas merged 1 commit intosymfony:1.xfrom
PhilDaiguille:feat/grapheme_strrev
Apr 26, 2026
Merged

[RFC] Add grapheme_strrev function php 8.6#578
nicolas-grekas merged 1 commit intosymfony:1.xfrom
PhilDaiguille:feat/grapheme_strrev

Conversation

@PhilDaiguille
Copy link
Copy Markdown
Contributor

Adds the new grapheme_strrev function added to PHP 8.6. This function is part of the Intl extension's Grapheme functions and reverses a string by grapheme clusters, correctly handling multi-byte and multi code-point characters (such as Emoji sequences).

Copy link
Copy Markdown
Contributor

@Ayesh Ayesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PhilDaiguille - thank you for the PR. I'm a regular contributor just like you, but I wrote the article mentioned in the PR. Thank you for the mention.

I marked one place that I'm not quite sure why there is a preg_match check against an empty regex, but other than that, the polyfill and the tests look good to me!

When the grapheme_str_split function was added, it was added to both Intl and PHP 8.4 polyfills, so maybe it makes sense to polyfill grapheme_strrev for both Intl and PHP 8.6 too? The PHP 8.6 polyfill can use an extension_loaded('intl') so it only polyfills if the older PHP version has the "real" Intl extension.

Comment thread src/Intl/Grapheme/Grapheme.php Outdated
@PhilDaiguille PhilDaiguille requested a review from Ayesh April 20, 2026 19:50
Comment thread src/Intl/Grapheme/bootstrap80.php
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @PhilDaiguille.

@nicolas-grekas nicolas-grekas merged commit 816dbdc into symfony:1.x Apr 26, 2026
1 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants