note 118978 added to function.str-pad
| From: | Anonymous | Date: | Fri, 11 Mar 2016 10:26:01 +0000 |
| Subject: | note 118978 added to function.str-pad | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205136@lists.php.net to get a copy of this message | ||
Here is the mcinp's version of mb_str_pad bugfixed:
<?php
function mb_str_pad($input, $pad_length, $pad_string=' ',
$pad_type=STR_PAD_RIGHT,$encoding='UTF-8'){
$mb_diff=mb_strlen($input, $encoding)-strlen($input);
return str_pad($input,$pad_length-$mb_diff,$pad_string,$pad_type);
}
?>
Still working correctly only if $pad_string is non-multibyte string
----
Server IP: 72.52.91.14
Probable Submitter: 84.72.125.205
----
Manual Page -- http://php.net/manual/en/function.str-pad.php
Edit -- https://master.php.net/note/edit/118978
Del: integrated -- https://master.php.net/note/delete/118978/integrated
Del: useless -- https://master.php.net/note/delete/118978/useless
Del: bad code -- https://master.php.net/note/delete/118978/bad+code
Del: spam -- https://master.php.net/note/delete/118978/spam
Del: non-english -- https://master.php.net/note/delete/118978/non-english
Del: in docs -- https://master.php.net/note/delete/118978/in+docs
Del: other reasons-- https://master.php.net/note/delete/118978
Reject -- https://master.php.net/note/reject/118978
Search -- https://master.php.net/manage/user-notes.php