Table of Contents

Syntax

void echo(string $str1 [, string $str2...])

(PHP 4, PHP 5)

$str1 An expression to output.
$str2… Unlimited number of additional expressions to output.
RETURNS Nothing (void).

What it Does

Sends output to the default device. In the case of a web page, this is the content delivered to the web browser. This is actually a language contruct rather than a function. This means you can use this statement without enclosing the arguments in parentheses (example shown below.)

There is a syntax shortcut for doing echo inside of HTML on your page. This looks like:

<p>
<b><?= $fullname ?></b>
</p>

Example

// echo without parentheses
echo '<h4>Hello World!</h4>';
 
// multiple arguments
echo 'Hi ', $first, ' ', $last, ', how are you?';
 
// you can use parentheses if you like
echo('<h4>Hello World!</h4>');