unable to print echo和print语句
程序员文章站
2024-01-03 18:28:28
...
在php中,有两种基本的输出方法:echo 和 print
echo 和 print 之间的差异:
- echo——能够输出一个以上的字符串,无返回值
- print——只能输出一个字符串,并始终返回值为1
echo的语句:
echo是一个语言结构,有无括号均可使用:echo 或echo();
例如:
显示字符串:
php
echo "
PHP is fun!
";echo "Hello world!";
echo "计划","学习","PHP";
?>
显示变量:
$txt1 = "Learn PHP";
$txt2 = "***.com";
$cars = array("Volvo","BWM","AABB");
echo $txt1;
echo "
";
echo "Study PHP at $txt2";
echo "
";
echo "my car is a {$cars[0]}";
?>
print的语句:
print也是语言结构,有无括号均可使用: print 或 print();
显示字符串:
print "
PHP is fun!
";print ""Hello world!
";
print "I'm about to learn PHP!";
?>
显示变量:
$txt1="Learn PHP";
$txt2="W3School.com.cn";
$cars=array("Volvo","BMW","SAAB");
print $txt1;
print "
";
print "Study PHP at $txt2";
print "My car is a {$cars[0]}";
?>
好了,暂时就这些了,想起来再补,欢迎广大网友来喷!!!!!!
以上就介绍了unable to print echo和print语句,包括了unable to print方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
推荐阅读
-
unable to print echo和print语句
-
PHP学习之输出字符串(echo,print,printf,print_r和var_dump)_php基础
-
8 PHP 5 echo 和 print 语句
-
PHP提升echo, printf, print, file
-
php中echo()和print()、require()和include()等易混淆函数的区别_PHP
-
powerpoint2003官方下载 PHP学习之输出字符串echo,print,printf,print_r和var_dump
-
php中print跟echo的区别,以及“”,‘’的区别
-
PHP学习之输出字符串(echo,print,printf,print_r和var_dump)_PHP教程
-
php中理解print EOT分界符和echo EOT的用法区别小结_PHP教程
-
php中echo()和print()、require()和include()等易混淆函数的区别