polyfill
polyfill copied to clipboard
[PHP 8.4] `mb_trim`, `mb_ltrim`, and `mb_rtrim` polyfills
RFC: Multibyte for trim function mb_trim, mb_ltrim and mb_rtrim
php.net: TBD
PHP.Watch: PHP 8.4: Mbstring: New mb_trim, mb_ltrim, and mb_rtrim functions
I think we can provide a polyfill for these functions. I created a small repo here with sample code that passes the test suite in php-src for this function. I'll happily submit a PR with it if you think that approach is good enough.
Thank you.
PRs are happily accepted.
This should be added in 2 places:
- in the mbstring polyfill
- in the php 8.4 polyfill (which needs to be created as it does not exist yet), but only when mbstring is available (see how
mb_str_splitis handled in the PHP 7.4 polyfill)