Echo and Print statements, echoprint statements
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 one string, and always return a value of 1
Echo's statement:
Echo is a language structure that 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:
$txt 1 = "Learn PHP";
$txt 2 = "***.com";
$cars = Array ("Volvo", "BWM", "AABB");
echo $txt 1;
echo "
";
echo "Study PHP at $txt 2";
echo "
";
echo "My car is a {$cars [0]}";
?>
Print's statement:
Print is also a language structure and can be used without brackets: print or print ();
Display string:
Print "
PHP is fun!
";
Print "" Hello world!
";
Print "I ' m about to learn php!";
?>
Display variables:
$txt 1= "Learn PHP";
$txt 2= "W3School.com.cn";
$cars =array ("Volvo", "BMW", "SAAB");
Print $txt 1;
Print "
";
Print "Study PHP at $txt 2";
Print "My car is a {$cars [0]}";
?>
Well, temporarily on these, think up again, welcome the vast number of netizens to spray!!!!!!
http://www.bkjia.com/PHPjc/1133564.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133564.html techarticle Echo and Print statements, echoprint statements in PHP, there are two basic output methods: Echo and print echo and print differences: echo can output more than one string, no return ...