Home > Backend Development > PHP Tutorial > PHP 5 echo and print statements

PHP 5 echo and print statements

WBOY
Release: 2016-07-29 08:58:19
Original
939 people have browsed it

  • There are two basic output methods in PHP: echo and print.

In this chapter we will discuss the usage of the two statements in detail and demonstrate how to use echo and print in examples.
PHP echo and print statements
The difference between echo and print:
echo - can output one or more strings
print - only allows one string to be output, and the return value is always 1
Tip: echo outputs faster than print, echo has no return value, and print has a return value of 1.
PHP echo statement
Echo is a language structure that can be used without parentheses or with parentheses: echo or echo().
Display string
The following example demonstrates how to use the echo command to output a string (the string can contain HTML tags):

  • PHP print statement

print is also a language structure that can use parentheses or not: print or print ().
Display string
The following example demonstrates how to use the print command to output a string (the string can contain HTML tags):

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the PHP 5 echo and print statements, including the relevant content. 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