Last Updated: February 25, 2016
· roncsak

UTF-8 str_pad in PHP

Last day I had a problem with the standard strpad. I was using strings encoded in UTF-8. Oddly in some cases strpad did not padded a string to the given number. This function fixes this problem.

function mb_str_pad(
  $pad_string=" ",
    return str_pad(

Originally was posted here: PHP: str_pad - Manual