Expressions And Operators: Echo

This intrinsic function converts the value of an expression to string (if necessary) and writes the string to standard output. For example:

$v1 = true;
$v2 = 123.45;
echo '>>'.$v1.'|'.$v2."<<\n"; // outputs ">>1|123.45<<"

$v3 = "abc{$v2}xyz";
echo "$v3\n";

For a discussion of value substitution in strings, see string literals. For conversion to strings, see type conversion.

Was This Page Useful?
Thank You!
Thank You! If you'd like to share more feedback, please file an issue.