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.';

Result:

You are reading a tutorial on PHP echo construct.

Example 2

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

Result:

Learn PHP

Example 3

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

Result:

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

Next: PHP explode Function



Copyright © 2023   1keydata.com  All Rights Reserved.  Privacy Policy   About   Contact