测试php代码,学习springf()函数
上一篇 /
下一篇 2007-08-05 15:51:37
/ 个人分类:学习日志
<?php
$s = 'monkey';
$t = 'many monkeys';
printf("[%s]\n", $s); // standard string output
printf("[%10s]\n", $s); // right-justification with spaces
printf("[%-10s]\n", $s); // left-justification with spaces
printf("[%010s]\n", $s); // zero-padding works on strings too
printf("[%'#10s]\n", $s); // use the custom padding character '#'
printf("[%10.10s]\n", $t); // left-justification but with a cutoff of 10 characters
$money = 1.4;
$formatted = sprintf ("%-02.2f", $money);
echo $formatted;
$number = 123;
$txt = sprintf("%f",$number);
echo $txt;
?>
相关阅读:
- Apache PHP MySql 的安装 (yueyong8758, 2007-1-03)
- php+mql+...开发某咨询公司网站心得 开发篇 (yueyong8758, 2007-1-05)
- 怎样才能成为PHP高手?学会"懒惰"的去编程 (yueyong8758, 2007-1-05)
- 如何高亮显示代码? (lster, 2007-1-16)
- PHP中的引用 (lster, 2007-1-16)
- 网页表单样式设计 (yueyong8758, 2007-3-29)
- CSS基础手册 (yueyong8758, 2007-3-29)
- CSS基础语法 (yueyong8758, 2007-3-29)
- 测试Php代码,学习springf()函数 (lster, 2007-8-05)
- 测试php代码,学习springf()函数 (lster, 2007-8-05)
导入论坛
收藏
分享给好友
管理
举报
TAG:
学习日志