unable to print echo and print statements

WBOY
Release: 2016-07-28 08:30:12
Original
1122 people have browsed it

In php, there are two basic output methods: echo and print

The difference between echo and print:

  • echo - can output more than one string, no return value
  • print - can only Output a string and always return a value of 1

echo statement:

echo is a language structure, which can be used with or without parentheses: echo or echo();

For example:

Display string:

echo "

PHP is fun!

";

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 "

PHP is fun!

";

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!