PHP Echo
PHP Echo Features
- it is a language construct so you are not required to use parentheses with it
- Therefore always uses parenthesis if you want to use more than one parameters.
- you know, echo not construct a function
- PHP Echo is a language.
- Always PHP echo statement can be used to print a string, multi-line strings, escaping characters, variable, array etc.

|
1 |
void echo ( string $arg1 [, string $... ] ) |
PHP Echo used to print string
File: string.php
|
1 2 3 |
<?php echo "Welcome Tutorial Scan"; ?> |
Output:
|
1 |
Welcome Tutorial Scan |
PHP Echo printing multiline string
File: multilinestring.php
|
1 2 3 |
<?php echo "Welcome Tutorial Scan Learn here PHP and web technologies and develope the dynamic website for your business"; ?> |
Output:
|
1 |
Welcome Tutorial Scan Learn here PHP and web technologies and develope the dynamic website for your business |
Printing escaping characters
File: echoprint.php
|
1 2 3 |
<?php echo "Welcome our \"Tutorial Scan\" Learn PHP"; ?> |
Output:
|
1 |
Welcome our "Tutorial Scan" Learn PHP |
Printing variable value
File: variableecho.php
|
1 2 3 4 |
<?php $message="Welcome my Tutorial Scan and learn PHP"; echo "Message is: $message"; ?> |
Output:
|
1 |
A message is: Welcome my Tutorial Scan and learn PHP |
Resource
PHP.Net