PHP echo

In PHP to print output echo statement is use.
PHP echo is use to print string, escaping characters, variable values.
The echo statement can be used with or without parentheses: echo or echo().

Syntax for echo:

Example

output:

Example:

In above program we see the echo statements inside double quotes (” “) will print value of variable.
Whereas, echo statements inside single quotes(‘ ‘) will print as it is.

echo is used to print variable, variable value, text, statement, multi-line statements, escping characters etc.

PHP echo: print variable value

Output:

PHP echo: print statement

Output:

PHP echo: print multi-line statements

Output:

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.