Skip to content

Instantly share code, notes, and snippets.

View ian-maurmann's full-sized avatar

Ian Maurmann ian-maurmann

  • Phoenix, Arizona, USA
View GitHub Profile
@rquadling
rquadling / mb_str_pad.php
Last active September 5, 2023 09:02
Implementation of a multi-byte equivalent of PHP's str_pad function.
/**
* Multibyte String Pad
*
* Functionally, the equivalent of the standard str_pad function, but is capable of successfully padding multibyte strings.
*
* @param string $input The string to be padded.
* @param int $length The length of the resultant padded string.
* @param string $padding The string to use as padding. Defaults to space.
* @param int $padType The type of padding. Defaults to STR_PAD_RIGHT.
* @param string $encoding The encoding to use, defaults to UTF-8.