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

echo() function in PHP

PHPz
PHPzforward
2023-08-21 09:33:171328browse

echo() function in PHP

The echo() function outputs one or more strings.

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

Syntax

echo(str)

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!";
?>

Output

Welcome!

Example

Let us see another example −

Live Demo

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

Output

Welcome! This is our website!

Example

Let us see another example −

Live Demo

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

Output

This demo text is on multiple lines.

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

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete