Home Menu

echo

Output one or more strings

Syntax

echo ( string $arg1 [, string $... ] ) : void

echo is a language construct, not a function, so parentheses are not required.

Parameters

arg1

The parameter to output.

...

Return

No value is returned.

Examples

1

<?

echo "Hello";

?>
Hello

2

<?

$arg1 = "Hello";

echo $arg1;

?>
Hello

3

<?

$arg1 = 'This ';
$arg2 = 'string ';
$arg3 = 'was ';
$arg4 = 'made ';
$arg5 = 'with ';
$arg6 = 'parameters, ';
$arg7 = 'each ';
$arg8 = 'passed ';
$arg9 = 'separately.';

echo $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9;

?>
This string was made with parameters, each passed separately.

4

<?

$arg1 = 'This ';
$arg2 = 'string ';
$arg3 = 'was ';
$arg4 = 'made ';
$arg5 = 'with ';
$arg6 = 'concatenation, ';
$arg7 = 'all ';
$arg8 = 'passed ';
$arg9 = 'together.';

echo $arg1 . $arg2 . $arg3 . $arg4 . $arg5 . $arg6 . $arg7 . $arg8 . $arg9;

?>
This string was made with concatenation, all passed together.

5

<?

$arg1 = 'Hello';

// invalid
//($arg1) ? echo 'true' : echo 'false';

// valid
echo $arg1 ? 'true' : 'false';

?>
true

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms