I’m just trying to make fixed the $str to 5 characters, but couldn’t.
$str = "nü";
echo str_pad($str, 5, "ü"); // give nüü
I know that’s an unicode issue and searched a lot but no luck. I unsuccessfully tried somethings such as this:
echo str_pad($str, 4 + mb_strlen($s), $s);
echo str_pad($str, 5 + mb_strlen($s), $s);
I think you need to look inside more php.net (here: http://php.net/str_pad#111147). But I changed it a bit.
Note: Don’t forget to call this before
mb_internal_encoding("utf-8");.Test here: http://codepad.viper-7.com/3jTEgt