此内容来自第三方平台 (Dailymotion)。如果此视频侵犯了您的版权,请使用 立即删除 工具。
Beginner PHP Tutorial - 9 - echo
描述
In PHP there are two basic ways to get output: echo and print.
In this tutorial we use echo (and print) in almost every example. So, this chapter contains a little more info about those two output statements.
PHP echo and print Statements
echo and print are more or less the same. They are both used to output data to the screen.
The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print.
The PHP echo Statement
The echo statement can be used with or without parentheses: echo or echo().
Display Text
The following example shows how to output text with the echo command (notice that the text can contain HTML markup):
Example
PHP is Fun!";
echo "Hello world!
";
echo "I'm about to learn PHP!
";
echo "This ", "string ", "was ", "made ", "with multiple parameters.";
?>
Run example »
Display Variables
The following example shows how to output text and variables with the echo statement:
Example
$txt1";
echo "Study PHP at $txt2
";
echo $x + $y;
?>
Run example »
The PHP print Statement
The print statement can be used with or without parentheses: print or print().
Display Text
The following example shows how to output text with the print command (notice that the text can contain HTML markup):
Example
PHP is Fun!";
print "Hello world!
";
print "I'm about to learn PHP!";
?>
Run example »
Display Variables
The following example shows how to output text and variables with the print statement:
Example
$txt1";
print "Study PHP at $txt2
";
print $x + $y;
?>
In this tutorial we use echo (and print) in almost every example. So, this chapter contains a little more info about those two output statements.
PHP echo and print Statements
echo and print are more or less the same. They are both used to output data to the screen.
The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print.
The PHP echo Statement
The echo statement can be used with or without parentheses: echo or echo().
Display Text
The following example shows how to output text with the echo command (notice that the text can contain HTML markup):
Example
PHP is Fun!";
echo "Hello world!
";
echo "I'm about to learn PHP!
";
echo "This ", "string ", "was ", "made ", "with multiple parameters.";
?>
Run example »
Display Variables
The following example shows how to output text and variables with the echo statement:
Example
$txt1";
echo "Study PHP at $txt2
";
echo $x + $y;
?>
Run example »
The PHP print Statement
The print statement can be used with or without parentheses: print or print().
Display Text
The following example shows how to output text with the print command (notice that the text can contain HTML markup):
Example
PHP is Fun!";
print "Hello world!
";
print "I'm about to learn PHP!";
?>
Run example »
Display Variables
The following example shows how to output text and variables with the print statement:
Example
$txt1";
print "Study PHP at $txt2
";
print $x + $y;
?>
关键词与标签
相关视频
Développer un site web en PHP, MySQL et Javascript PDF: jQuery, CSS3 et HTML5.
Shalyutinav
php tutorials in Urdu - Hindi - 9 - use html and javascript in php
InfoVideo
PHP Tutorial Urdu - 9 - Output HTML Using echo or print Free Urdu Tutorials Video training by Pakistan Education taleem.tv
Taleem Online
Beginner PHP Tutorial - 11 - Output HTML Using echo-print
ata ul Nasar Mansoor
READ ONLINE Learning PHP MySQL JavaScript With jQuery CSS HTML5 Learning Php Mysql Javascript
Emildeluxe 1o
Learning PHP MySQL & JavaScript: With jQuery CSS & HTML5 (Learning Php Mysql Javascript Css
Majhoul 0000000