下面一一进行介绍。
1. echo
echo 是PHP的一个关键字,它没有返回值。在写法上,它可以省略小括号。如下代码:
复制代码 代码如下:
echo 'Test String';
echo('Test String');
复制代码 代码如下:
print 'Test String';
print('Test String');
复制代码 代码如下:
printf("%7.2f", 1.2); // " 1.20"
printf("%-07.2f", 1.2); // "1.20000"
复制代码 代码如下:
$v = new test();
print_r($v);
var_dump($v);
class test {
public $num = 1;
public $str = "222";
public $bln = true;
复制代码 代码如下:
test Object
(
[num] => 1
[str] => 222
[bool] => 1
)
object(test)#1 (3) {
["num"]=>
int(1)
["str"]=>
string(3) "222"
["bool"]=>
bool(true)
}
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号