Home  >  Article  >  Backend Development  >  Tutorial on str_pad_PHP

Tutorial on str_pad_PHP

WBOY
WBOYOriginal
2016-07-13 10:51:19839browse



Question
About str_pad
Solution
The code is written like this

$the_max = 32;

$the_max = (int)intval(strlen($the_max));



print(str_pad('1',$the_max,'0',STR_PAD_LEFT));

?>


When I copy the code, the result is still 1. What's going on?

[ ]


Reference answer
No, my test is correct 01
Reference answer
The original post was published by lsx220 on 2009-1-4 02:03 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=814107&ptid=100305]Link tag [img]http://bbs. 111cn.cn/images/common/back.gif[/img][/url]
No, my test is correct 01
I was eerily right again, damn it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632580.htmlTechArticleThe problem is about str_pad. The solution code is written like this $the_max = 32; $the_max = (int)intval(strlen ($the_max)); print(str_pad('1',$the_max,'0',STR_PAD_LEFT)); ?> Copy the code and the result...
Statement:
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 admin@php.cn