str_pad() 将字符串填充成指定长度的字符串_PHP教程

WBOY
Release: 2016-07-21 14:55:11
Original
1077 people have browsed it

/**
* 将字符串填充成指定长度的字符串(多字节安全)
* @param string $str 指定被填充的字符串
* @param int $len 指定被填充的字符串的长度,如果值为负数或小于字符串的长度则不填充
* @param string $pad_str 要填充的字符串
* @param int $pad_type 指定填充的方向STR_PAD_RIGHT,STR_PAD_LEFT或STR_PAD_BOTH
* @return string
*/

// string str_pad(string $str, int $len, string $pad_str, string $pad_type);

echo str_pad($result2[0],6,"0",STR_PAD_LEFT);

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/364479.htmlTechArticle/** * 将字符串填充成指定长度的字符串(多字节安全) * @param string $str 指定被填充的字符串 * @param int $len 指定被填充的字符串的长度,如果值...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!