php输出语句print printf echo sprintf比较
1、<?php
echo "Some dynamic output here";
?>
Some static output here
<?php
销斤 echo "I love the summertime.";
?>
echo语句是语言结构。
2、 <?php
print("I love the summertime.");
?>
<?php
$season="summertime";
print("级海八I love the $season.");
?>
print()有返回值。王扯
3、 printf("Bar inventory: %d bottles of tonic water.",100);
// 传入二个参数:
printf("%d bottles of tonic water cost $%f",100,43.20);
用来格式化数据。
4、 $cost=sprintf("$%.2f",43.2);
不会在浏览器显示。
阅读量:146
阅读量:89
阅读量:192
阅读量:173
阅读量:86