PHP技术编程中“字符串”的小常识(2)
3.14 3.143.1415900000abcdefghi 3.14,3.141590, 3.142\m1111011 123 123.000000 test
---------------------------------------------------------------------
2.字符串填充
string str_pad(string input原始字串, int length添加后的总长度[, string padding要填充的字符 [, int pad_type]填充类型])
填充类型有添加在左边STR_PAD_LEFT,默认添在右边,填充在两端STR_PAD_BOTH
$index = array("one"=>1,"two"=>155,"three"=>1679);
echo "
";
echo str_pad("这是标题",50," ",STR_PAD_BOTH)."\n";
foreach($index as $inkey=>$inval)
echo str_pad($inkey,30,".").str_pad($inval,20,".",STR_PAD_LEFT)."\n";
echo "
";
---------------------输出结果----------------------------------------
这是标题
one..............................................1
two............................................155
three.........................................1679
---------------------------------------------------------------------
string strtolower(string subject)//转换为小写
相关新闻>>
- 发表评论
-
- 最新评论 更多>>