The echo() function outputs one or more strings.
Note − echo() function is faster than print().
Syntax
echo(str)
Parameters
str − string to be sent to the output
Return
The echo() function returns nothing.
Example
The following is an example: −
<?php echo "Welcome!"; ?>
Output
Welcome!
Example
Let us see another example −
<?php $str1 = "Welcome!"; $str2 = "This is our website!"; echo $str1 . " " . $str2; ?>
Output
Welcome! This is our website!
Example
Let us see another example −
<?php echo "This demo text is on multiple lines."; ?>
Output
This demo text is on multiple lines.