This is an old revision of the document!
PHP RFC: mb_str_pad
- Version: 0.1
- Date: 2023-05-19
- Author: Niels Dossche (nielsdos), dossche.niels@gmail.com
- Status: Draft
- First Published at: http://wiki.php.net/rfc/mb_str_pad
Introduction
Many string functions in PHP come in two different variants: one for byte strings, and one for multibyte strings. This RFC proposes the addition of mb_str_pad to PHP as a multibyte equivalent of the existing str_pad function. The current str_pad function lacks multibyte character support, causing issues when working with languages that utilize multibyte encodings like UTF-8.
Proposal
All the features and examples of the proposal.
To paraphrase Zeev Suraski, explain hows the proposal brings substantial value to be considered for inclusion in one of the world's most popular programming languages.
Remember that the RFC contents should be easily reusable in the PHP Documentation.
If applicable, you may wish to use the language specification as a reference.
Backward Incompatible Changes
None.
Proposed PHP Version(s)
Next PHP 8.x (at the time of writing this is PHP 8.3).
RFC Impact
To SAPIs
None.
To Existing Extensions
mbstring: A new function mb_str_pad() will be added to mbstring. The implementation reuses existing internal functions of mbstring, so besides the new function no internal functions will be added. No existing functions change.
To Opcache
None.
New Constants
None.
php.ini Defaults
None.
Open Issues
Make sure there are no open issues when the vote starts!
Unaffected PHP Functionality
Everything outside of mbstring.
Future Scope
None.
Proposed Voting Choices
One primary yes/no vote to decide if the function may be introduced.
Patches and Tests
Implementation: https://github.com/nielsdos/php-src/tree/mb_str_pad
Implementation
After the project is implemented, this section should contain
- the version(s) it was merged into
- a link to the git commit(s)
- a link to the PHP manual entry for the feature
- a link to the language specification section (if any)
References
Original issue report suggesting this feature: https://github.com/php/php-src/issues/10203
Rejected Features
Keep this updated with features that were discussed on the mail lists.