Home > Backend Development > PHP Tutorial > echo() function in PHP

echo() function in PHP

PHPz
Release: 2023-08-21 09:34:01
forward
1367 people have browsed it

echo() function in PHP

The echo() function outputs one or more strings.

Note - echo() function is faster than print() function.

Syntax

echo(str)
Copy after login

Parameters

  • str − The string to send to the output

Return value

The echo() function does not return anything.

Example

The following is an example: −

Online Demonstration

<?php
   echo "Welcome!";
?>
Copy after login

Output

Welcome!
Copy after login

Example

Let us see another example −

Live Demo

<?php
   $str1 = "Welcome!";
   $str2 = "This is our website!";
   echo $str1 . " " . $str2;
?>
Copy after login

Output

Welcome! This is our website!
Copy after login

Example

Let us see another example −

Live Demo

<?php
   echo "This demo
   text is on
   multiple
   lines.";
?>
Copy after login

Output

This demo text is on multiple lines.
Copy after login

The above is the detailed content of echo() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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