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

addcslashes

addslashes

bin2hex

chop

chr

chunk_split

convert_uudecode

convert_uuencode

count_chars

crc32

crypt

explode

fprintf

get_html_translation_table

hebrev

hebrevc

hex2bin

html_entity_decode

htmlentities

htmlspecialchars

htmlspecialchars_decode

implode

join

lcfirst

levenshtein

localeconv

ltrim

md5

md5_file

metaphone

nl_langinfo

nl2br

number_format

ord

parse_str

print

printf

quoted_printable_decode

quoted_printable_encode

quotemeta

rtrim

setlocale

sha1

sha1_file

similar_text

soundex

sprintf

sscanf

str_contains

str_ends_with

str_getcsv

str_ireplace

str_pad

str_repeat

str_replace

str_rot13

str_shuffle

str_split

str_starts_with

str_word_count

strcasecmp

strchr

strcmp

strcoll

strcspn

strip_tags

stripcslashes

stripos

stripslashes

stristr

strlen

strnatcasecmp

strnatcmp

strncasecmp

strncmp

strpbrk

strpos

strrchr

strrev

strripos

strrpos

strspn

strstr

strtok

strtolower

strtoupper

strtr

substr

substr_compare

substr_count

substr_replace

trim

ucfirst

ucwords

vfprintf

vprintf

vsprintf

wordwrap

PHP

Home Menu