rfc:mb_str_pad

This is an old revision of the document!


PHP 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

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

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.

rfc/mb_str_pad.1684518114.txt.gz · Last modified: 2023/05/19 17:41 by nielsdos