In php, there are two basic output methods: echo and print
The difference between echo and print:
echo statement:
echo is a language structure, which can be used with or without parentheses: echo or echo();
For example:
Display string:
php
echo "
echo "Hello world!";
echo "Plan","Learn","PHP";
?>
Display variables:
$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 statement:
Print is also a language structure and can be used with or without parentheses: print or print();
Display string:
print "
print ""Hello world!
";
print "I'm about to learn PHP!" ; G? & Gt;
Display variables:
& lt ;? php$ txt1 = "leocn 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]}";
?> Okay, that’s it for now, I’ll add it when I think about it, everyone is welcome to comment! ! The above introduces the unable to print echo and print statements, including the content of unable to print. I hope it will be helpful to friends who are interested in PHP tutorials.