How to use php echo

藏色散人
Release: 2023-03-03 19:50:01
Original
3238 people have browsed it

php echo is used to output one or more strings. Its syntax is "echo(strings)". The parameter strings represents one or more strings to be sent to the output, and echo is not actually a function. So no need to use parentheses on it.

How to use php echo

Recommended: "PHP Video Tutorial"

php echo definition and usage

echo() function outputs one or more strings.

Note: The echo() function is not actually a function, so you don't have to use parentheses with it. However, if you wish to pass more than one argument to echo(), using parentheses will generate a parsing error.

Tip: The echo() function is slightly faster than print().

Tip: The echo() function also has abbreviated syntax. Prior to PHP 5.4.0, this syntax only worked if the short_open_tag configuration setting was enabled.

Syntax

echo(strings)
Copy after login

Parameters

strings Required. One or more strings to send to the output.

Return value: No return value.

PHP version: 4

Example

Write the value of the string variable ($str) to the output:

<?php
$str = "Hello world!";
echo $str;
?>
Copy after login

Run result:

Hello world!
Copy after login

The above is the detailed content of How to use php echo. For more information, please follow other related articles on the PHP Chinese website!

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