PHP echo Function

PHP Tutorial > String Functions > echo

In PHP, echo is used to output one or more strings. Even though echo behaves like a string function, it is technically not a function, as it doesn't require a parenthesis.

The syntax of the echo construct is:

echo [string]

where [string] means one or more strings.

Let's take a look at the examples below:

Example 1

echo 'You are reading a tutorial on PHP echo construct.';


You are reading a tutorial on PHP echo construct.

Example 2

$var = 'Learn PHP';
echo $var;


Learn PHP

Example 3

echo 'This shows ' . 'how echo can ', 'be used to concatenate a string.';


This shows how echo can be used to concatenate a string.

Next: PHP explode Function

Copyright © 2023  All Rights Reserved.  Privacy Policy   About   Contact